Amazon RDS - Tugas MS SQL DBA
Sebagai layanan RDS, MSSQL DB memiliki banyak tugas DBA yang tersedia sebagai layanan terkelola. Anda tidak memiliki akses shell ke DB, tetapi melalui konsol atau melalui perintah di perangkat lunak klien, Anda dapat menjalankan berbagai aktivitas DBA. Di bawah ini adalah tugas DBA yang paling umum dan sering digunakan yang dilakukan di server Ms SQL Amazon RDS.
CDC menangkap perubahan yang dibuat pada data dalam tabel. Perubahan yang dibuat ke tabel pengguna ditangkap dalam tabel perubahan yang sesuai. Tabel perubahan ini memberikan gambaran historis dari perubahan dari waktu ke waktu. Fungsi penangkapan data perubahan yang disediakan SQL Server memungkinkan data perubahan untuk dikonsumsi dengan mudah dan sistematis.
Gunakan perintah di bawah ini di SSMS yang terhubung ke server RDS MSSQL untuk mengaktifkan dan menonaktifkan CDC.
#Enable CDC for RDS DB Instance
exec msdb.dbo.rds_cdc_enable_db '
' #Disable CDC for RDS DB Instance exec msdb.dbo.rds_cdc_disable_db '
'
Next to track the changes in a specific table we use the stored procedure sp_cdc_enable_table with the below command.
#Begin tracking a table
exec sys.sp_cdc_enable_table
@source_schema = N'
'
, @source_name = N'
' , @role_name = N'
' , @captured_column_list = '
' ;
Modifying tempdb Database Options
The tempdb system database is a global resource which is available to all users connected to the instance of SQL Server and is used to hold the following
Temporary user objects that are explicitly created, such as: global or local temporary tables, temporary stored procedures, table variables, or cursors.
Internal objects that are created by the SQL Server Database Engine, for example, work tables to store intermediate results for spools or sorting.
Row versions that are generated by data modification transactions in a database that uses read-committed using row versioning isolation or snapshot isolation transactions.
Following are examples of How you modify the RDS MSSQL tempdb for various DBA activities.
# setting the size to 100 GB and file growth to 10 percent.
alter database[tempdb] modify file (NAME = N'templog', SIZE=100GB, FILEGROWTH = 10%)
# set the MAXSIZE property to prevent tempdb database from using all available disk space.
alter database [tempdb] modify file (NAME = N'templog', MAXSIZE = 2048MB)
# Shrinking the tempdb Database file size and requests a new size
exec msdb.dbo.rds_shrink_tempdbfile @temp_filename = N'test_file', @target_size = 10;
OFFLINE to ONLINE Transition
You can transition your Microsoft SQL Server database on an Amazon RDS DB instance from OFFLINE to ONLINE using the following command.
EXEC rdsadmin.dbo.rds_set_database_online name
Non-English Character Set
During the creation of RDS MSSQL instance, the default collation marked for the DB is English. But it can be changed to another non-English language by applying the COLLATE clause along with the name of the collation. The below example illustrates that.
CREATE TABLE [dbo].[Account]
(
[AccountID] [nvarchar](10) NOT NULL,
[AccountName] [nvarchar](100) COLLATE Japanese_CI_AS NOT NULL
) ON [PRIMARY];