GUIDE SQL JESS DAVID
GUZMN GALLEGOS
Jess David Guzmn Gallegos
TESSELAR
GUIDE SQL JESS DAVID GUZMN GALLEGOS
BACKUP
The first thing to do within Microsoft SQL Management Studio is to create a
productive database backup, I mean the one that is used daily, as shown in the
following image
Figure 1 main menu SQL management Studio
We need to right click inside the database to back up, after this will show us the
following options
Figure 2 TASKS SQL management Studio
We need to choose on tasks option and then choose back up option.
1
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Figure 3 Back-UP option
Will show us a window like the following one, where we choose the path where to
save the backup
Figure 4 save Back-Up option
2
GUIDE SQL JESS DAVID GUZMN GALLEGOS
On this window can see the path to save the
backup and then we can type a name for the file
(remember, if you want to save the file on
another folder, you need has all the permissions
on this folder).
Figure 5 path of back-up
The next step to do a backup click on OK button
Figure 6 Back-Up option
3
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Finally, the system shows a message like the following image
Figure 7 successfull message
4
GUIDE SQL JESS DAVID GUZMN GALLEGOS
NEW DATABASE
To Restore a backup its optional to create a new database like the following picture,
this options its for create an environmental test or do some another things, on this
example we create a new database, to restore this information on the new database.
Right click on the databases folder, and then new database.
Figure 8 New Database Option
The next step its type a database name
Figure 9 database name
5
GUIDE SQL JESS DAVID GUZMN GALLEGOS
We choose this option on collation, because it is kind of our language, it has usually
to associate the database to the language.
Figure 10 New database configuration
We choose auto shrink true and parametrization simple
Figure 11 parametrization
Figure 12 Auto shrink
Finally, we can see the new database
Figure 13 check new database successfull
6
GUIDE SQL JESS DAVID GUZMN GALLEGOS
RESTORE
To restore the information of the database is necessary to right click and select the
option of tasks and select restore, we will do it inside the database previously created
to take it as an example.
Figure 14 Restore option path
This option show a new window, on this window we can choose the device to select
the database, the database source and the database destination
Figure 15 restore option
7
GUIDE SQL JESS DAVID GUZMN GALLEGOS
We select device option, because we have a backup of the latest database, we can
add the path on add button.
Figure 16 add path to restore
We choose the path to choose the backup; on this case, we find the path.
Figure 17 path to restore
8
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Then. We choose the destination, automatic, the system use the main database, but
we can change it, we can choose another database
Figure 18 restore configuration
On this step its necessary overwrite the existing database and finally, click on OK
button
Figure 19 restore options
9
GUIDE SQL JESS DAVID GUZMN GALLEGOS
SHRINK
Each file within a database can be reduced to remove unused pages. Although the
Database Engine will reuse space effectively, there are times when a file no longer
needs to be as large as it once was; shrinking the file may then become necessary.
Both data and transaction log files can be reduced, or shrunk. The database files
can be shrunk manually, either as a group or individually, or the database can be set
to shrink automatically at specified intervals.
Files are always shrunk from the end. For example, if you have a 5-GB file and
specify 4 GB as the target_size in a DBCC SHRINKFILE statement, the Database
Engine will free as much space as it can from the last 1 GB of the file. If there are
used pages in the part of the file being released, the Database Engine first relocates
the pages to the part of the file being retained. You can only shrink a database to
the point where it has no free space remaining. For example, if a 5-GB database has
4 GB of data and you specify 3 GB as the target_size of a DBCC SHRINKFILE
statement, only 1 GB will be freed.
It is necessary to insert the following command, the 10 it is the percent free at the
end.
10
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Figure 20 shrink command
11
GUIDE SQL JESS DAVID GUZMN GALLEGOS
BEST PRACTICE
To do a best practice and do a best performance on the server, it is necessary to
limit the server memory, this option it has for be more careful with the memory, we
choose 2048 mb because we have 2 users on the server.
Figure 21 propeties option
Figure 22 memory configuration
12
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Figure 23 memory configuration
13
GUIDE SQL JESS DAVID GUZMN GALLEGOS
SAP
For finish this guide its necessary check all on SAP, we can see the new database
Figure 24 sap log
We choose the new database, on the case of, we cannot see the database we can
click on refresh button and then we can see the changes
Figure 25 databases
14
GUIDE SQL JESS DAVID GUZMN GALLEGOS
You cannot change the database name on SAP on the following path
Figure 26 details option
On this option, we can type the new database name and then click on update.
Figure 27 change name option
15