oracle物理 结构即物理操作系统文件的集合。
控制文件(参数文件init.ora记录了控制文件的位置)
二进制文件,控制文件由参数control_files指定,格式如下:control_files=("home/app/.../control01.ctl","home/app/.../control02.ctl") 。
1、要对控制文件进行镜象,手工镜像步骤如下:
a.shutdown
b.cp ***.ctl
c.修改参数文件,新增控制文件位置
d.startup
2、控制文件包括信息:
数据库的名字,检查点信息,数据库创建的时间戳,所有的 数据文件,联机日志文件, 归档日志文件信息,备份信息等。
鉴于控制文件的重要性,一般采用多个镜相复制来保护控制文件,或采用RAID来保护控制文件。控制文件信息可以从V$Controlfile中查询获得。
3、新增/移动一个数据库控制文件
SQL>select name from v$controlfile;
NAME
--------------------------------------------------------------------------------------
/u01/app/oracle/oradata/ora10/control01.ctl
/u01/app/oracle/oradata/ora10/control02.ctl
/u01/app/oracle/oradata/ora10/control03.ctl
SQL>create pfile from spfile;
SQL>shutdown immediate;
$ mv control03.ctl ../controlbak.ctl 备份
$ cp control03.ctl control04.ctl 更改为4
$vi $ORRACLE_HOME/dbs/init$ORACLE_SID.ora 改参数
SQL>startuppfile '$ORACLE_HOME/dbs/init$ORACLE_SID.ora';
SQL>select name from v$controlfile;
NAME
--------------------------------------------------------------------------------------
/u01/app/oracle/oradata/ora10/control01.ctl
/u01/app/oracle/oradata/ora10/control02.ctl
/u01/app/oracle/oradata/ora10/control04.ctl
SQL>create spfile from pfile;
4、所有控制文件被破坏的恢复
SQL>alter database backup controlfile to trace;每增加一个文件,必须输此命令,文件才完整,所有文件记录将保存在 跟踪文件中
Vi /u01/app/oracle/admin/ora10/udump/ora10_ora_11956.trc
LOGFILE
GROUP1'/u01/app/oracle/oradata/ora10/redo01.log' SIZE50M,
GROUP2'/u01/app/oracle/oradata/ora10/redo02.log' SIZE50M,
GROUP3'/u01/app/oracle/oradata/ora10/redo03.log' SIZE50M
--STANDBYLOGFILE
DATAFILE
'/u01/app/oracle/oradata/ora10/system01.dbf',
'/u01/app/oracle/oradata/ora10/undotbs01.dbf',
'/u01/app/oracle/oradata/ora10/sysaux01.dbf',
'/u01/app/oracle/oradata/ora10/users01.dbf',
'/u01/app/oracle/oradata/ora10/example01.dbf'
CHARACTERSETZHS16GBK
SQL>startup
启动失败
SQL>startup nomount
SQL>alter system set
control_files '/u01/app/oracle/oradata/ora10/netcontrolfile01',
'/u01/app/oracle/oradata/ora10/netcontrolfile02' scope spfile;
SQL> shutdown immediate
重启生效
ORA-01507:database not mounted
ORACLE instance shutdown.
SQL>startup nomount;
ORACLE instance started.
SQL>select value from v$parameter where name= 'control_files'; 查看新设定
VALUE
----------------------------------------------------------------------------------
/u01/app/oracle/oradata/ora10/netcontrolfile01,/u01/app/oracle/oradata/ora10/netcontrolfile02
?
SQL>create controlfile database ora10 noresetlogs;(可从跟踪文件中获得,前提alter database backup......)
2 logfile
3 group1'/u01/app/oracle/oradata/ora10/redo01.log',
4 group2'/u01/app/oracle/oradata/ora10/redo02.log',
5 group3'/u01/app/oracle/oradata/ora10/redo03.log'
6 datafile
7 '/u01/app/oracle/oradata/ora10/sysaux01.dbf',
8 '/u01/app/oracle/oradata/ora10/system01.dbf',
9 '/u01/app/oracle/oradata/ora10/undotbs01.dbf',
10 '/u01/app/oracle/oradata/ora10/users01.dbf',
11 '/u01/app/oracle/oradata/ora10/example01.dbf'
12 characterset zhs 16gbk;
Controlfilecreated.
SQL>alter database open;
Database altered.
SQL>alter tablespace temp tempfile
‘/u01/app/oracle/oradata/ora10/temp.dbf’ size24125440
Reuse autoextend off; (以避免排序报错reuse指重用原OS文件)
Tablespace altered.
SQL>hostls �Cl /u01/app/oracle/oradata/ora10/ne* (控制文件已生成)
-rw-r-----1 oracle oinstall 6078464 Mar 31 14:50
/u01/app/oracle/oradata/ora10/netcontrolfile02
-rw-r-----1 oracle oinstall 6078464 Mar 31 14:50
/u01/app/oracle/oradata/ora10/netcontrolfile01
CUUG
更多oracle视频教程请点击: http://crm2.qq.com/page/portalpage/wpa.php?uin=800060152&f=1&ty=1&aty=0&a=&from=6