data gurad物理備份方式下standby_file_management為auto時修改表空間的操作

eric0435發表於2012-12-04
STANDBY_FILE_MANAGEMENT設定為AUTO
增加及刪除表空間和資料檔案
我們先來看看初始化引數的設定: ----standby 資料庫操作
SQL> show parameter standby_file
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
standby_file_management string AUTO

A).增加新的表空間--primary 資料庫操作
SQL>CREATE TABLESPACE mytest DATAFILE '/u01/app/oracle/oradata/jytest/mytest01.dbf' size 20M
表空間已建立。
檢查剛新增的資料檔案
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/jytest/system01.dbf
/u01/app/oracle/oradata/jytest/undotbs01.dbf
/u01/app/oracle/oradata/jytest/sysaux01.dbf
/u01/app/oracle/oradata/jytest/users01.dbf
/u01/app/oracle/oradata/jytest/hygeia01.dbf
/u01/app/oracle/oradata/jytest/mytest01.dbf

6 rows selected

SQL>

SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
TEMP
HYGEIA
MYTEST

7 rows selected

SQL>

切換日誌
SQL> alter system switch logfile;
系統已更改。
B).驗證standby 庫--standby 資料庫操作
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/jytest/system01.dbf
/u01/app/oracle/oradata/jytest/undotbs01.dbf
/u01/app/oracle/oradata/jytest/sysaux01.dbf
/u01/app/oracle/oradata/jytest/users01.dbf
/u01/app/oracle/oradata/jytest/hygeia01.dbf
/u01/app/oracle/oradata/jytest/mytest01.dbf

6 rows selected.

SQL>




SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
TEMP
HYGEIA
MYTEST

7 rows selected.

SQL>

可以看到,表空間和資料檔案已經自動建立,你是不是奇怪為什麼資料檔案路徑自動變成了jytest(因為我這裡是主備不在同一臺機器上且資料庫結構目錄相同),因為我們設定了db_file_name_convert 嘛。

C).刪除表空間--primary 資料庫操作
SQL> drop tablespace mytest including contents and datafiles;

Tablespace dropped

SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/jytest/system01.dbf
/u01/app/oracle/oradata/jytest/undotbs01.dbf
/u01/app/oracle/oradata/jytest/sysaux01.dbf
/u01/app/oracle/oradata/jytest/users01.dbf
/u01/app/oracle/oradata/jytest/hygeia01.dbf

SQL> alter system switch logfile;

System altered

SQL>



提示:使用including 子句刪除表空間時,
D).驗證standby 資料庫--standby 資料庫操作
SQL> select name from v$datafile;

NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/jytest/system01.dbf
/u01/app/oracle/oradata/jytest/undotbs01.dbf
/u01/app/oracle/oradata/jytest/sysaux01.dbf
/u01/app/oracle/oradata/jytest/users01.dbf
/u01/app/oracle/oradata/jytest/hygeia01.dbf

SQL>

SQL> select name from v$tablespace;

NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
USERS
TEMP
HYGEIA

6 rows selected.

SQL>
得出結論,對於初始化引數STANDBY_FILE_MANAGMENT 設定為auto 的話,對於表空間和數
據檔案的操作完全無須dba 手工干預,primary 和standby 都能很好的處理

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-750528/,如需轉載,請註明出處,否則將追究法律責任。

相關文章