Alibabacloud.com offers a wide variety of articles about mssql restore database from bak, easily find your mssql restore database from bak information here online.
The SQL restoration method for the master database is only for how to restore the mdf file database, mastermdf
First, let's talk about how SQL Server restores the master database. The specific steps are as follows:
Step 1:CopyModel. mdf, mastlog. ldf, model. mdf, modellog. ldf, msdbdata. mdf, msdblog. ldfFile.From X: \
Label:In the online search of information and practice, you can use the following code to restore the backed up databaseRESTORE database [NEW_TTTTT]--New library nameFrom DISK = N ' E:\DBBackup\tttt_1\tttt_1_Full_2016_06_04_155332.bak '--backup fileWith FILE = 1,MOVE n ' tttt_1 ' to n ' E:\test\new_tttt.mdf ',--new additional location for the original
account of the MSSQLServer service must have the same name and password as the valid access to the shared directory, in this way, you can pass the verification (so you can use another valid user instead, only the user name and password must be the same and have sufficient permissions)
Let's look at this example.
SQL code -- example of how to restore data to a specified time point-- Create a Test DatabaseCreate
database DNName set recovery simple with NO_WAITGOAlter database DNName set recovery simple -- SIMPLE modeGOUSE DNNameGODbcc shrinkfile (n'dnname _ log', 11, TRUNCATEONLY)GOUSE [master]GOAlter database DNName set recovery full with NO_WAITGOAlter database DNName set recovery full --
be set in the root directory where the backup was created. Backup uses the backup set password provided by the PASSWORD option to create a back-up set. In addition, BACKUP typically verifies the media password provided by the Mediapassword option before writing to the media. The only time that BACKUP does not verify the media password is when the media is formatted This overrides the media header. If backup writes to the media header, backup assigns the media set password to the value specified
file name, maxsize=20) Special Note: Follow the steps, do not enterLine the previous steps, do not do the following steps otherwise it may damage your database. It is generally not recommended to do the 4th, 62 step 4th step Unsafe, it is possible to damage the database or lost data 6th step if the log reaches the upper limit, subsequent database processing will
1. set bakupfolder = F: \ backup \Backup files are stored in the directory F: \ backup \ (this directory must be created in advance)2. By default, each database is placed in a subdirectory with the same name under bakupfolder (automatically created by the script); When lay_in_subfolder is set to 0, it is directly placed in bakupfolder3. The time string when the backup is automatically added to the backup file name. You do not have to worry about dupli
Data | database | Log |mssql| compression
The database in the cumulative operation process, not only its own volume will slowly grow, its log capacity size as well as the database entity file growth and will occupy a lot of space. the size of the MSSQL
Label: A) Data import and export between data tables on the same database server: 1. If the structure of the table tb1 and TB2 is identical, the data in table TB1 can be imported into the table TB2 using the following command: INSERT INTO DB2.TB2 select * from DB1.TB1 2. If the table tb1 and TB2 only have partial fields that are identical, to implement importing some of the fields from tb1 into the same field in TB2, use the following command: Inser
Database ' Test ' (located on file 1).
The BACKUP LOG operation successfully processed 2 pages and took 0.111 seconds (0.087 Mb/sec).
9 to restore the oldest full backup
1> RESTORE DATABASE test from disk= ' D:program filesmicrosoft SQL servermssql
BACKUP Est_1.bak ' with N
'test _ log' file of the database 'test' (located on file 1 ).The backup log operation successfully processed two pages and took 0.111 seconds (0.087 MB/second ).
9. Restore the oldest full backup1> Restore database test from disk = 'd: Program filesmicrosoft SQL servermssqlBackup est_1.
Under the full recovery model or the bulk-logged recovery model, you must back up the active transaction log (called the tail of the log) before you can restore the database in Sqlservermanagementstudio. For more information, see How to Back up the transaction log (Sqlservermanagementstudio). To restore an encrypted database
ASP tutorial. NET C # Database tutorial backup and restore two methods (SQL Server)The following is mainly about using C # to back up the MSSQL server database. Look at the code below,
Backup methods///SqlConnection conn = new SqlConnection ("server=.; Database=master;us
Label:1--Simulating a disaster when restoring a Adventurework database example Stopat
2
3 BACKUP database AdventureWorks
4 to disk= ' D:\MSSQL\Databackup\ Adventureworks.bak '
5
6 BACKUP LOG AdventureWorks
7 to DISK = ' D:\MSSQL\Databackup\AdventureWorks.trn '
8 GO
9--after a disaster, try to create a tail-lo
Label:SSMs is somewhat convenient for us to do some common things. But sometimes it's not so impersonal. In particular, error messages.Today, I encountered an error while doing a database restore: The specified conversion is not valid. (Sqlmanagerui)Specified cast is not valid. (Sqlmanagerui)No way, have to hit the code:RESTORE from DISK = N'D:\XXDB. BAK'GOWhat you see is this:It turns out that it was encr
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.