Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of replicating database with the same instance of SqlServer

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Method 1 sql script

Open Miscrosoft sql server manager studio- New query

Backup database

Click (here) to collapse or open

Backup database ebiz_hrh to disk=N'd:\ msbackup\ ebiz_hrh.bak'

D:\ msbackup\ is the backup file path

Ebiz_hrh.bak is the backup file name

View database name and related information

Click (here) to collapse or open

RESTORE headeronly

FROM DISK = naughd:\ msbackup\ ebiz_hrh.bak'

Query the content.

Click (here) to collapse or open

NULL NULL 1 NULL 01 2 ECMSSQL-200-44\ Administrator ECMSSQL-200-44 ebiz_hrh 661 2017-06-01 11 purl 05purl 20.000 64217088

7430000000411100080 7430000000414400001 7430000000411100080 7430000000407200037 2017-07-30 22 purse 29PLO 56.000 2017-07-30 22 140 2958.000 00

2052 196609 4608 10 50 1600 ECMSSQL-200-44512 E84CF3CE-640B-4812-A462-A086071061B5 A440C1CC-00CB-45AD-8F52-2AE9DEAA1EE7

Chinese_PRC_CI_AS 80A21385-21F4-4B6E-96D7-4024C0A83A15 00 00 00 A440C1CC-00CB-45AD-8F52-2AE9DEAA1EE7

NULL SIMPLE NULL NULL Database C6EBE3B3-B0E0-4A29-9107-CE3B39FE08FF 64217088

View backup file information here contains database path and related information

Click (here) to collapse or open

RESTORE filelistonly

FROM DISK = naughd:\ msbackup\ ebiz_hrh.bak'

Check out the content

Click (here) to collapse or open

Ebiz3 D:\ msdata\ ebiz_hrh.mdf D PRIMARY 294649856 35184372080640 1 00 C78CA25C-8032-4B25-AFCD-58CB8B7008DA 00 63766528 512 1 NULL 7430000000407200037 50B7D728-EC28-470B-A46D-9FC72A1880D8 0 1 NULL

Ebiz3_log D:\ msdata\ ebiz_hrh_1.ldf L NULL 298909696 35184372080640 200 C011D8CA-F1B3-4971-B38F-11CC987A92E0 0005120 NULL 000000000-0000-0000-0000-000000000000 01 NULL

Restore the database

Click (here) to collapse or open

Restore database ebiz_hrh_copy from disk = naughd:\ msbackup\ ebiz_hrh.bak'

With

Move 'ebiz3' to'd:\ data\ ebiz_hrh_copy.mdf'

Move 'ebiz3_log' to'd:\ data\ ebiz_hrh_copy.ldf'

Here ebiz_hrh_copy is the name of the replicated database.

D:\ msbackup\ ebiz_hrh.bak backup file path

Ebiz3 is the name of the logicalname that we looked up.

D:\ data\ is the path after recovery

Name of mdf after ebiz_hrh_copy.mdf recovery

Ldf name after ebiz_hrh_copy.ldf recovery

Method 2: graphical interface

Backup

Open Miscrosoft sql server manager studio

Right-click the database selection task to be replicated-backup-backup destination-backup to disk-add (delete the original backup path before adding)-Select path-enter file name-Click backup

Reduction

Open Miscrosoft sql server manager studio

Right-click the database and select restore-fill in the database name (be careful not to match the source database name)

Select the source device-find the file you just backed up-check the restored backup set-click options-modify the restore path and name (be sure to do so unless this example is restored)-Click OK

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report