Professional Documents
Culture Documents
JOBSHEET-2: BEKERJA
DENGAN DATABASE
Oleh :
Step 2: Change the initial value of the tempdev database file to 20MB and click OK to increase
the size of tempdb.
Step 3: Right-click tempdb in Object Explorer again and select Reports -> Standard Reports ->
Disk Usage and note that the size of tempdb has changed and that the tempdb data file is
almost empty. (In the pie chart, this is shown as "Unallocated")
Step 4: Highlight and execute the following code against the master database.
Step 5: Right click tempdb in Object Explorer and select Reports -> Standard Reports -> Disk
Usage and note that the size of tempdb has changed and that tempdb data file is full.
Expand Data/Log File Autogrow/Autoshrink Events to view the autogrow events that
happened.
Step 6: Restart the Proseware server (In Object Explorer right-click the Proseware server, and
click Restart. In the Microsoft SQL Server Management Studio dialog window, click
Yes. In the Next Microsoft SQL Server Management Studio dialog window, click Yes).
Step 7: Right click tempdb in Object Explorer and select Reports -> Standard Reports -> Disk
Usage and note that the size of tempdb has changed back to the previous configured size
of 20MB.
Creating Databases
1. Step 1: Open Object Explorer, expand Proseware, right-click Databases and click New Database.
Step 2: In the new database dialog type NewDB as the database name. Review the default initial
sizes for data and log file sizes that will be created and keep the values as provided and
click OK.
Step 3: Right-click NewDB in Object Explorer, select Properties and review the database
created. (On the general tab, note the size and space available and how that relates to
the sizes shown on the Files tab. close the Database Properties - NewDB window)
Step 4: Create a database using T-SQL
Altering Databases
1. Step 1: Add a new file to the NewDB database created before.
File groups
1. Step 1: Add a Filegroup and data file to the Branch database created before. (Right-click
Databases in Object Explorer and click Refresh. Right-click the Branch database and
click Properties. Select the Files tab and click Add. In the new line that is added, enter
Branch_dat2 as the Logical Name, and choose <New Filegroup> for the Filegroup. In
the popup window, enter Data_FG as the name of the new filegroup and click OK, then
click OK to save the database properties)
Step 2: Create a new table.
Step 3: Check the filegroup that the table was created in.
The table was created in the PRIMARY filegroup as it is declared as the default filegroup
of the database. Note that it is best practice that the PRIMARY filegroup is only used for system
objects and not user data,when several filegroups are used in the database.
Step 4: Drop the table and create it in the Data_FG filegroup.
Step 5: Check the filegroup that the table was created in.
Step 2: Move the existing default tempdb files to the new location.
Note the message that tells you that the change will be applied on the next restart.
Step 3: In Windows Explorer, navigate to D:\TEMPDB and note that the files have not moved
yet.
Step 4: Add three new data files to tempdb
Step 7: Navigate to D:\TEMPDB and note that the file has now been moved.
Also navigate to D:\MKTG and L:\MKTG and note that the original files are still there and
should be deleted, to avoid confusion.
Lab Scenario
1. Sebagai database administrator anda diharapkan bisa mengkonfigurasi basisdata. Anda
harus membuat basisdata baru pada server, sesuai dengan spesifikasi kebutuhan
aplikasi yang dibutuhkan oleh vendor (tabel). Klien mengirimkan basisdata yang akan
diinstal pada instance server baru. Selain mengirimkan backup, klient juga
mengirimkan basisdata yang telah detach dan log file. Anda perlu untuk meng attach
(memasang) basisdata tersebut pada instance server yang baru.