Jesús David Guzmán Gallegos Tesselar
Jesús David Guzmán Gallegos Tesselar
GUZMN GALLEGOS
BACKUP
We need to right click inside the database to back up, after this will show us the
following options
1
GUIDE SQL JESS DAVID GUZMN GALLEGOS
Will show us a window like the following one, where we choose the path where to
save the backup
2
GUIDE SQL JESS DAVID GUZMN GALLEGOS
3
GUIDE SQL JESS DAVID GUZMN GALLEGOS
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.
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 11 parametrization
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.
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
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.
We choose the path to choose the backup; on this case, we find the path.
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
On this step its necessary overwrite the existing database and finally, click on OK
button
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
11
GUIDE SQL JESS DAVID GUZMN GALLEGOS
BEST PRACTICE
12
GUIDE SQL JESS DAVID GUZMN GALLEGOS
13
GUIDE SQL JESS DAVID GUZMN GALLEGOS
SAP
For finish this guide its necessary check all on SAP, we can see the new database
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
On this option, we can type the new database name and then click on update.
15