三、控制文件的多路复用技术
(1)多路复用技术的配置
关于多路复用有两种配置方式,一种是在数据库nomount的方式下修改参数,另一种是直接修改参数文件。
将数据库启动到nomount,修改参数。
SYS@ENMOEDU > startup nomount
Oracle instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
SYS@ENMOEDU > alter system set control_files=
'/u01/app/oracle/oradata/ENMOEDU/control01.ctl','/u01/app/oracle/oradata/control01.ctl' scope=spfile;
System altered.
将控制文件拷贝到另一个需要放置控制文件的路径。
[oracle@ENMOEDU dbs]$ cp /u01/app/oracle/oradata/ENMOEDU/control01.ctl /u01/app/oracle/oradata/control01.ctl
重启数据库,查看控制文件状态。
SYS@ENMOEDU > shutdown immediate
ORACLE instance shut down.
SYS@ENMOEDU > startup
ORACLE instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
Database mounted.
Database opened.
SYS@ENMOEDU > select name from v$controlfile;
NAME
--------------------------------------------------
/u01/app/oracle/oradata/ENMOEDU/control01.ctl
/u01/app/oracle/oradata/control01.ctl
控制文件的多路复用成功。
第二种方法是直接修改init.ora文件。
首先创建pfile。
SYS@ENMOEDU > create pfile from spfile;
File created.
修改pfile。
[oracle@ENMOEDU dbs]$ vi initENMOEDU.ora
将控制文件那一项修改。
*.control_files='/u01/app/oracle/oradata/ENMOEDU/control01.ctl','/u01/app/oracle/oradata/control01.ctl'
创建spfile。
SYS@ENMOEDU > create pfile from spfile;
File created.
启动数据库,查看控制文件状态。
SYS@ENMOEDU > shutdown immediate
ORACLE instance shut down.
SYS@ENMOEDU > startup
ORACLE instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
Database mounted.
Database opened.
SYS@ENMOEDU > select name from v$controlfile;
NAME
--------------------------------------------------
/u01/app/oracle/oradata/ENMOEDU/control01.ctl
/u01/app/oracle/oradata/control01.ctl
控制文件的多路复用成功。
至此,控制文件的多路复用已经实现了。下面我们将做一个实验,来看看多路复用技术是怎么保障控制文件的正常使用的。
正常启动数据库。删除其中一份控制文件。
SYS@ENMOEDU > startup
ORACLE instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
Database mounted.
Database opened.
[oracle@ENMOEDU oradata]$ rm -rf /u01/app/oracle/oradata/control01.ctl
正常关闭数据库,发现不能关闭,用shutdown abort 的方式关闭。
SYS@ENMOEDU > shutdown abort
ORACLE instance shut down.
以nomount的方式打开数据库。
SYS@ENMOEDU > startup nomount
ORACLE instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
修改参数,将已删除的控制文件从参数中删除。
SYS@ENMOEDU > alter system set control_files= '/u01/app/oracle/oradata/ENMOEDU/control01.ctl' scope=spfile;
System altered.
关闭数据库,重启。
SYS@ENMOEDU > shutdown immediate
ORACLE instance shut down.
SYS@ENMOEDU > startup
ORACLE instance started.
Total System Global Area 292933632 bytes
Fixed Size 1344512 bytes
Variable Size 222301184 bytes
Database Buffers 62914560 bytes
Redo Buffers 6373376 bytes
Database mounted.
Database opened.
SYS@ENMOEDU > select name from v$controlfile;
NAME
--------------------------------------------------
/u01/app/oracle/oradata/ENMOEDU/control01.ctl
至此,数据库已经成功启动。
综上所述,本文总结了控制文件的用户管理备份和恢复、RMAN备份和恢复、多路复用的相关知识点。我才疏学浅,知识匮乏,只能尽绵薄之力总结自身所学,狂生之言,仅为笑谈。