Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't copy Database to another machine. Yes you can take back up to same machine and copy it to another machine and do restore.</p> <p>To take backup follow procedure:</p> <ol> <li>Right Click on the database you want to take backup.</li> <li>Choose Task -> Back Up.</li> <li>In Destination, Choose Add.</li> <li>In File Name click on <code>...</code> button and choose destination folder where you want to backup with backupname.bak . Click Ok, Ok and Ok. and wait until backup process is completed. Click Ok.</li> </ol> <p>Now copy that backup file into pendrive or any media and paste it to another machine and Open SQL Server 2008 R2</p> <p>To restore backup follow procedure:</p> <ol> <li>Right Click on the Databases.</li> <li>Choose Restore Database.</li> <li>Write database name which you want to restore in To Database field</li> <li>Select From device radio button in Source for restore. Click on <code>...</code></li> <li>Click on Add button, Select database backup file you have pasted. Click Ok, Ok.</li> <li>Check the checkbox of Restore in Select the beckup sets to restore.</li> <li>Go on Options Check Overwrite the existing database &amp; Preserve the replication settings (this fields needed to check only when you try to restore database which is already resided on that another device)</li> <li>Click Ok. wait until restore complete and click ok.</li> </ol> <p>Tell me if you face any problem.</p> <hr> <p><strong>By Code</strong></p> <p><em>To Backup:</em></p> <pre><code>USE DATABASE_NAME; GO BACKUP DATABASE DATABASE_NAME TO DISK = 'D:\DATABASE_NAME.Bak' WITH FORMAT, MEDIANAME = 'D_SQLServerBackups', NAME = 'Full Backup of DATABASE_NAME'; GO </code></pre> <p>(If you want to put backup in any folder, the folder must be exist before you take the backup.)</p> <p><em>To Restore:</em></p> <p>Step 1: Retrive the Logical file name of the database from backup.</p> <pre><code>RESTORE FILELISTONLY FROM DISK = 'D:BackUpYourBaackUpFile.bak' GO </code></pre> <p>Step 2: Use the values in the LogicalName Column in following Step. ----Make Database to single user Mode</p> <pre><code>ALTER DATABASE YourDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE </code></pre> <p>----Restore Database</p> <pre><code>RESTORE DATABASE YourDB FROM DISK = 'D:BackUpYourBaackUpFile.bak' WITH MOVE 'YourMDFLogicalName' TO 'D:DataYourMDFFile.mdf', MOVE 'YourLDFLogicalName' TO 'D:DataYourLDFFile.ldf' </code></pre> <p>/<em>If there is no error in statement before database will be in multiuser mode. If error occurs please execute following command it will convert database in multi user.</em>/</p> <pre><code>ALTER DATABASE YourDB SET MULTI_USER GO </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload