Amazonrds 简明教程

Amazon RDS - Oracle DBA Tasks

作为数据库行业领先的技术,Oracle 自带许多功能使得 DBA 活动易于管理,甚至在云中也是如此。Amazon RDS Oracle DB 提供许多存储过程和函数,可以使用 SQL Developer 客户端工具访问这些过程和函数。可以使用 Amazon RDS 实例创建期间创建的用户 ID 和密码执行此过程。以下是一些最常用的 DBA 活动示例。

As an industry leading database technology, oracle has many in-built features which makes it easy to manage the DBA activities, even in the cloud. The Amazon RDS oracle DB provides access to many stored procedures and functions which can be accessed using the SQL developer client tool. This procedure can be executed using the user ID and password created during the Amazon RDS instance creation. Below are the examples of some of the most frequently used DBA activities.

Killing a Session

有时需要通过终止会话终止长时间运行的查询或任何其他 DB 活动。我们使用 Amazon RDS 过程 rdsadmin.rdsadmin_util.kill 终止会话。以下代码执行该操作。

Sometimes a long running query or any other DB activity needs to be killed by killing the session. We use the Amazon RDS procedure rdsadmin.rdsadmin_util.kill to kill a session. The following code does that.

# First get the session identifier and the session serial number,
select SID, SERIAL#, STATUS from V$SESSION where USERNAME = 'AWSUSER';

# Next use the procedure
begin
    rdsadmin.rdsadmin_util.kill(
        sid    => sid,
        serial => serial_number);
end;
/

Setting the Default Tablespace

Amazon RDS 过程 rdsadmin.rdsadmin_util.alter_default_tablespace 可用于使用以下命令设置数据库的默认表空间。

The Amazon RDS procedure rdsadmin.rdsadmin_util.alter_default_tablespace can be used to set to the default tablespace for a DB using the following command.

exec rdsadmin.rdsadmin_util.alter_default_tablespace(tablespace_name => 'AWSuser');

Setting the Database Time Zone

我们可以使用 Amazon RDS 过程 rdsadmin.rdsadmin_util.alter_db_time_zone 更改数据库时区。

We can use the Amazon RDS procedure rdsadmin.rdsadmin_util.alter_db_time_zone to changes the time zone for the DB.

# Change the time zone of the DB to UTC + 5.30
exec rdsadmin.rdsadmin_util.alter_db_time_zone(p_new_tz => '+5:30');
# Change the time zone to a specific region
exec rdsadmin.rdsadmin_util.alter_db_time_zone(p_new_tz => 'Asia/Kolkata');

Adding Online Redo Logs

我们可以使用 Amazon RDS 过程 rdsadmin.rdsadmin_util.add_logfile 添加其他重做日志。以下命令添加大小为 128MB 的日志文件。

We can use the Amazon RDS procedure rdsadmin.rdsadmin_util.add_logfile to add additional redo logs. The following command adds a log file of size 128MB.

exec rdsadmin.rdsadmin_util.add_logfile(p_size => '128M');