First, click on the desktop "SQL Server Management Studio" Open, sql2005 Manager, click "Connect" login, as shown:
First, create a new database
1. New Database
Right-click on "Database"--"New database", as shown in figure:
MSSQL2005 Backup Restore Graphics tutorial
Fill in the database name, such as MyData, select the database to save the path, generally can keep the default address, click OK.
2. New User
Right-click on "Security"--"login name"--"New login name", as shown in figure:
MSSQL2005 Backup Restore Graphics tutorial
Fill in the login name, such as MyData. Select SQL Server Authentication and enter the password. Below the "Mandatory password expiration" Do not choose, the default database select your user login to the corresponding database, such as MyData. As shown in figure:
Click on "User Mapping", "map to this login user" to check the corresponding database, such as MyData. The database member role is checked "public" and "db_owner" and the point "OK" is selected. As shown in figure:
The new database is complete.
Second, restore the database
First upload the database backup bak file to the server, recommended to the D:\mssql directory, such as Mydata.bak. Right-click the database you want to restore, select "Tasks"--"restore"--"database", as shown in figure:
Note that if you are in a different directory, it is important to ensure that the directory is preceded by Mssqluser Full Control, otherwise the restore or backup fails. Save the backup directory must also have this permission!!
If you do not have an earlier backup on this server, select "Source Device", click "..." on the right side to find the Bak file, the backup set will be displayed below, and "restore" the check. As shown in figure:
Then click "Options", check "Overwrite existing database", "restore the database file to:" File path to the current database file, click "OK" began to restore, the backup is too large, restore time to a little longer. As shown in figure:
After the restore succeeds, the system prompts you, as shown in figure:
After the restore succeeds, check to see if the schema for the following table is dbo, as shown in figure:
If the database name or other schema, such as the MyData schema, requires a new MyData schema with the owner dbo in security-schema.
Create a new MyData schema with owner dbo, as shown in figure:
Third, additional database
First upload your database MDF and LDF files to a directory on the server (typically not on the system disk to avoid system corruption causing data loss), such as the D:\mssql directory, and give the directory Mssqluser Full Control.
Note that if you are in a different directory, it is important to ensure that the directory is preceded by Mssqluser Full Control, otherwise the restore or backup fails. Save the backup directory must also have this permission!!
Second, right click on your database, select additional, as shown:
Click Add to add your MDF file. As shown in figure:
Click OK to attach a successful database, you can see the new attached database in the database. As shown in figure:
Note that if you are in a different directory, it is important to ensure that the directory is preceded by Mssqluser Full Control, otherwise the restore or backup fails. Save the backup directory must also have this permission!!