ÖØÇì˼ׯOracle¡¢RedhatÈÏ֤ѧϰÂÛ̳

 ÕÒ»ØÃÜÂë
 ×¢²á

QQ怬

Ö»ÐèÒ»²½£¬¿ìËÙ¿ªÊ¼

ËÑË÷
²é¿´: 843|»Ø¸´: 0
´òÓ¡ ÉÏÒ»Ö÷Ìâ ÏÂÒ»Ö÷Ìâ

sqlserver¸½¼ÓÊý¾Ý¿â

[¸´ÖÆÁ´½Ó]
Ìøתµ½Ö¸¶¨Â¥²ã
Â¥Ö÷
·¢±íÓÚ 2023-1-15 14:16:06 | Ö»¿´¸Ã×÷Õß »ØÌû½±Àø |ÕýÐòä¯ÀÀ |ÔĶÁģʽ
±¾Ìû×îºóÓÉ ÁõÔóÓî ÓÚ 2023-1-15 14:17 ±à¼­

ÏȾöÌõ¼þ
¼ÌÐø֮ǰ£¬Çë²é¿´ÒÔÏÂËùÓÐÏȾöÌõ¼þ£º
  • Èç¹ûÒª½«Êý¾Ý¿â´ÓÒ»¸öʵÀýÒƵ½ÁíÒ»¸öʵÀý£¬Ôò±ØÐëÏȽ«Êý¾Ý¿âÓëÈκÎÏÖÓÐ SQL ʵÀý·ÖÀë¡£ Èç¹û³¢ÊÔ¸½¼Óδ·ÖÀëµÄÊý¾Ý¿â£¬»á·µ»Ø´íÎó¡£   
  • ¸½¼ÓÊý¾Ý¿âʱ£¬Êý¾Ý¿âµÄËùÓÐÊý¾ÝÎļþ¶¼±ØÐë¿ÉÓᣠͨ³££¬¶ÔÓÚÊý¾ÝÎļþ£¬ÕâЩÎļþµÄÀ©Õ¹ÃûΪ .mdf »ò ndf£»¶ÔÓÚÊÂÎñÈÕÖ¾Îļþ£¬ÔòÀ©Õ¹ÃûΪ .ldf¡£ ´ËÍ⣬FILESTREAM Êý¾ÝµÄÈκÎÎļþ×鶼±ØÐë´æÔÚ²¢ÇÒ¿ÉÓᣠ 
  • Èç¹ûÈκÎÊý¾ÝÎļþµÄ·¾¶²»Í¬ÓÚÊ״δ´½¨Êý¾Ý¿â»òÉϴθ½¼ÓÊý¾Ý¿âʱµÄ·¾¶£¬Ôò±ØÐëÖ¸¶¨ÎļþµÄµ±Ç°Â·¾¶¡£
  • Êý¾Ý¿âÒýÇæ·þÎñÕÊ»§±ØÐë¾ßÓжÁÈ¡ÆäÐÂλÖÃÖеÄÎļþµÄȨÏÞ¡£
  • Èç¹ûÔÚÄ㸽¼ÓÊý¾Ý¿âʱ£¬MDF ºÍ LDF ÎļþλÓÚ²»Í¬Ä¿Â¼£¬²¢ÇÒÆäÖÐÒ»Ìõ·¾¶°üº¬ \\?\GlobalRoot£¬Ôò¸Ã²Ù×÷½«Ê§°Ü¡£

¶ÔÓÚ±¸·ÝºÍ»¹Ô­£¬½¨Ò鲻ҪʹÓ÷ÖÀëÔÙ¸½¼Ó²Ù×÷¡£ ·ÖÀëÒª´Ó SQL Server Íⲿ±¸·ÝµÄÎļþʱ£¬Ã»ÓÐÊÂÎñÈÕÖ¾±¸·Ý»òʱ¼äµã»¹Ô­¿ÉÓá£


ȨÏÞ
ÐèÒª CREATE DATABASE¡¢CREATE ANY DATABASE »ò ALTER ANY DATABASE ȨÏÞ¡£
ʹÓà SQL Server Management Studio (SSMS)Òƶ¯Êý¾Ý¿â֮ǰ
Èç¹ûÒªÒƶ¯Êý¾Ý¿â£¬ÇëÔÚ½«ËüÓëÆäÏÖÓÐ SQL Server ʵÀý·ÖÀë֮ǰ£¬Ê¹Óá°Êý¾Ý¿âÊôÐÔ¡±Ò³²é¿´ÓëÊý¾Ý¿â¹ØÁªµÄÎļþ¼°Æ䵱ǰλÖá£
  • ÔÚSQL Server Management Studio ¶ÔÏó×ÊÔ´¹ÜÀíÆ÷ÖУ¬Á¬½Óµ½SQL ServerÊý¾Ý¿âÒýÇæµÄʵÀý£¬È»ºóÕ¹¿ªÊµÀý¡£
  • Õ¹¿ª ¡°Êý¾Ý¿â¡± £¬²¢Ñ¡ÔñÒª·ÖÀëµÄÓû§Êý¾Ý¿âµÄÃû³Æ¡£
  • ÓÒ¼üµ¥»÷Êý¾Ý¿âÃû³Æ£¬²¢Ñ¡Ôñ¡°ÊôÐÔ¡±¡£ Ñ¡Ôñ¡°Îļþ¡±Ò³£¬²¢²é¿´¡°Êý¾Ý¿âÎļþ:¡±±íÖеÄÌõÄ¿¡£

·ÖÀë¡¢Òƶ¯ºÍ¸½¼Ó֮ǰ£¬ÇëÎñ±Ø¿¼ÂÇÓëÊý¾Ý¿â¹ØÁªµÄËùÓÐÎļþ¡£ È»ºó£¬¼ÌÐøÖ´ÐÐÏÂÒ»²¿·ÖÖеķÖÀë¡¢Îļþ¸´Öƺ͸½¼ÓÊý¾Ý¿â²½Öè¡£
¸½¼ÓÊý¾Ý¿â
  • ÔÚSQL Server Management Studio¶ÔÏó×ÊÔ´¹ÜÀíÆ÷ÖУ¬Á¬½Óµ½SQL ServerÊý¾Ý¿âÒýÇæµÄʵÀý£¬È»ºóÑ¡ÔñÔÚ SSMS ÖÐÕ¹¿ª¸ÃʵÀýÊÓͼ¡£
  • ÓÒ¼üµ¥»÷¡°Êý¾Ý¿â¡±£¬È»ºóÑ¡Ôñ¡°¸½¼Ó¡±¡£
  • ÔÚ¡°¸½¼ÓÊý¾Ý¿â¡±¶Ô»°¿òÖУ¬ÈôÒªÖ¸¶¨Òª¸½¼ÓµÄÊý¾Ý¿â£¬ÇëÑ¡Ôñ¡°Ìí¼Ó¡±¡£ ÔÚ¡°¶¨Î»Êý¾Ý¿âÎļþ¡±¶Ô»°¿òÖУ¬Ñ¡ÔñÊý¾Ý¿âËùÔÚµÄλÖã¬È»ºóÕ¹¿ªÄ¿Â¼Ê÷À´²éÕÒÊý¾Ý¿âµÄ .mdf Îļþ²¢½«ÆäÑ¡ÖУ¬ÀýÈ磺
    C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Data.mdf

¡°Òª¸½¼ÓµÄÊý¾Ý¿â¡±
ÏÔʾËùÑ¡Êý¾Ý¿âµÄÓйØÐÅÏ¢¡£
<ÎÞÁбêÌâ>
ÏÔʾһ¸öͼ±ê£¬ÓÃÒÔָʾ¸½¼Ó²Ù×÷µÄ״̬¡£ ¡°×´Ì¬¡±ËµÃ÷ÖнéÉÜ¿ÉÄܵÄͼ±ê¡£
MDF ÎļþλÖÃ
ÏÔʾѡ¶¨ MDF ÎļþµÄ·¾¶ºÍÎļþÃû¡£
Database Name
ÏÔʾÊý¾Ý¿âµÄÃû³Æ¡£
¸½¼ÓΪ
¸ù¾ÝÐèÒª£¬¿ÉÒÔÖ¸¶¨Òª¸½¼ÓÊý¾Ý¿âµÄÆäËûÃû³Æ¡£
ËùÓÐÕß
ÌṩÊý¾Ý¿â¿ÉÄÜËùÓÐÕßµÄÏÂÀ­ÁÐ±í£¬Äú¿ÉÒÔ¸ù¾ÝÐèÒª´ÓÆäÖÐÑ¡ÔñÆäËûËùÓÐÕß¡£
Status
ÏÔʾϱíÖÐÏàÓ¦µÄÊý¾Ý¿â״̬£º

ͼ±ê
״̬Îı¾
˵Ã÷
£¨ÎÞͼ±ê£©£¨ÎÞÎı¾£©´Ë¶ÔÏóµÄ¸½¼Ó²Ù×÷ÉÐδÆô¶¯»òÕß¿ÉÄܹÒÆð¡£ ÕâÊÇ´ò¿ª¸Ã¶Ô»°¿òʱµÄĬÈÏÖµ¡£
ÂÌÉ«µÄÓÒÏòÈý½ÇÐÎÕýÔÚ½øÐÐÒÑÆô¶¯¸½¼Ó²Ù×÷£¬µ«ÊǸòÙ×÷δÍê³É¡£
ÂÌÉ«µÄÑ¡Öбê¼ÇSuccessÒѳɹ¦¸½¼Ó¸Ã¶ÔÏó¡£
°üº¬°×É«Ê®×ÖÐεĺìɫԲȦ´íÎ󸽼ӲÙ×÷Óöµ½´íÎó£¬Î´³É¹¦Íê³É¡£
°üº¬×ó¡¢ÓÒÁ½¸öºÚÉ«ÏóÏÞºÍÉÏ¡¢ÏÂÁ½¸ö°×É«ÏóÏÞµÄԲȦÒÑÍ£Ö¹ÓÉÓÚÄãÍ£Ö¹Á˸½¼Ó²Ù×÷£¬¸Ã²Ù×÷δ³É¹¦Íê³É¡£
°üº¬Ò»¸öÖ¸ÏòÄæʱÕë·½ÏòµÄÇúÏß¼ýÍ·µÄԲȦÒѻعö¸½¼Ó²Ù×÷Òѳɹ¦£¬µ«ÒѶÔÆä½øÐлعö£¬ÒòΪÔÚ¸½¼ÓÆäËû¶ÔÏóµÄ¹ý³ÌÖгöÖÁË´íÎó¡£

ÏûÏ¢
ÏÔʾ¿ÕÏûÏ¢»ò¡°ÕÒ²»µ½Îļþ¡±³¬Á´½Ó¡£
Ìí¼Ó
²éÕÒ±ØÐèµÄÖ÷Êý¾Ý¿âÎļþ¡£ Ñ¡Ôñ .mdf Îļþʱ£¬¾Í»áÔÚ¡°Òª¸½¼ÓµÄÊý¾Ý¿â¡±Íø¸ñµÄÏàÓ¦×Ö¶ÎÖÐ×Ô¶¯Ìî³äºÏÊʵÄÐÅÏ¢¡£
ɾ³ý
´Ó ¡°Òª¸½¼ÓµÄÊý¾Ý¿â¡± Íø¸ñÖÐɾ³ýÑ¡¶¨Îļþ¡£
¡°<database_name>¡±Êý¾Ý¿âÏêϸÐÅÏ¢
ÏÔʾҪ¸½¼ÓµÄÎļþµÄÃû³Æ¡£
ԭʼÎļþÃû
ÏÔʾÊôÓÚÊý¾Ý¿âµÄÒѸ½¼ÓÎļþµÄÃû³Æ¡£
ÎļþÀàÐÍ
ָʾÎļþÀàÐÍ£¬¼´ ¡°Êý¾Ý¡± »ò ¡°ÈÕÖ¾¡± ¡£
µ±Ç°Îļþ·¾¶
ÏÔʾËùÑ¡Êý¾Ý¿âÎļþµÄ·¾¶¡£ ¿ÉÒÔÊÖ¶¯±à¼­¸Ã·¾¶¡£
ÏûÏ¢
ÏÔʾ¿ÕÏûÏ¢»ò ¡°ÕÒ²»µ½Îļþ¡± ³¬Á´½Ó¡£

ʹÓà Transact-SQLÒƶ¯Êý¾Ý¿â֮ǰ
Èç¹ûÒªÒƶ¯Êý¾Ý¿â£¬ÇëÔÚ½«ËüÓëÆäÏÖÓÐ SQL Server ʵÀý·ÖÀë֮ǰ£¬Ê¹Óà sys.database_files ϵͳĿ¼ÊÓͼ²é¿´ÓëÊý¾Ý¿â¹ØÁªµÄÎļþ¼°Æ䵱ǰλÖá£
  • ÔÚSQL Server Management StudioÖУ¬Ñ¡Ôñ¡°Ð½¨²éѯ¡±ÒÔ´ò¿ª²éѯ±à¼­Æ÷¡£
  • ½«ÒÔÏ Transact-SQL ½Å±¾¸´ÖƵ½²éѯ±à¼­Æ÷£¬È»ºóÑ¡Ôñ¡°Ö´ÐС±¡£ ´Ë½Å±¾ÏÔʾÎïÀíÊý¾Ý¿âÎļþµÄλÖᣠͨ¹ý·ÖÀë/¸½¼ÓÀ´Òƶ¯Êý¾Ý¿âʱ£¬ÇëÎñ±Ø¿¼ÂÇËùÓÐÎļþ¡£
    USE [database_name] GO  SELECT type_desc, name, physical_name from sys.database_files;
·ÖÀë¡¢Òƶ¯ºÍ¸½¼Ó֮ǰ£¬ÇëÎñ±Ø¿¼ÂÇÓëÊý¾Ý¿â¹ØÁªµÄËùÓÐÎļþ¡£ È»ºó£¬¼ÌÐøÖ´ÐÐÏÂÒ»²¿·ÖÖеķÖÀë¡¢Îļþ¸´Öƺ͸½¼ÓÊý¾Ý¿â²½Öè¡£
¸½¼ÓÊý¾Ý¿â
  • Á¬½Óµ½ Êý¾Ý¿âÒýÇæ¡£
  • ÔÚ±ê×¼À¸ÉÏ£¬Ñ¡Ôñ¡°Ð½¨²éѯ¡±¡£
  • ʹÓôø FOR ATTACH ×Ó¾äµÄ [color=var(--theme-hyperlink)]CREATE DATABASE Óï¾ä¡£
    ½«ÒÔÏÂʾÀý¸´ÖƲ¢Õ³Ìùµ½²éѯ´°¿ÚÖУ¬È»ºóÑ¡Ôñ¡°Ö´ÐС±¡£ ±¾Ê¾Àý¸½¼Ó AdventureWorks2019 Êý¾Ý¿âµÄËùÓÐÎļþ£¬²¢½«Êý¾Ý¿âÖØÃüÃûΪ MyAdventureWorks¡£
    CREATE DATABASE MyAdventureWorks       ON (FILENAME = 'C:\MySQLServer\AdventureWorks_Data.mdf'),       (FILENAME = 'C:\MySQLServer\AdventureWorks_Log.ldf')       FOR ATTACH;  
    ÄãµÄÊý¾Ý¿â¿ÉÄÜÓÐÆäËûÊý¾ÝÎļþ£¨Í¨³£ÊÇ .mdf »ò .ndf£©£¬²¢ÇÒÐèÒªÔÚ CREATE DATABASE ... FOR ATTACH Óï¾äÖаüº¬ÆäËûÎļþ¡£ ´ËÍ⣬»¹±ØÐëÔÚÓï¾äÖаüº¬ FILESTREAM Êý¾ÝµÄÈκÎÎļþ×é¡£




·ÖÏíµ½:  QQºÃÓѺÍȺQQºÃÓѺÍȺ QQ¿Õ¼äQQ¿Õ¼ä ÌÚѶ΢²©ÌÚѶ΢²© ÌÚѶÅóÓÑÌÚѶÅóÓÑ
ÊÕ²ØÊÕ²Ø Ö§³ÖÖ§³Ö ·´¶Ô·´¶Ô
»Ø¸´

ʹÓõÀ¾ß ¾Ù±¨

ÄúÐèÒªµÇ¼ºó²Å¿ÉÒÔ»ØÌû µÇ¼ | ×¢²á

±¾°æ»ý·Ö¹æÔò

QQ|ÊÖ»ú°æ|СºÚÎÝ|ÖØÇì˼ׯOracle¡¢RedhatÈÏ֤ѧϰÂÛ̳ ( ÓåICP±¸12004239ºÅ-4 )

GMT+8, 2024-11-28 20:58 , Processed in 0.115623 second(s), 20 queries .

ÖØÇì˼ׯѧϰÖÐÐÄÂÛ̳-ÖØÇì˼ׯ¿Æ¼¼ÓÐÏÞ¹«Ë¾ÂÛ̳

© 2001-2020

¿ìËٻظ´ ·µ»Ø¶¥²¿ ·µ»ØÁбí