转:oracle添加controlfile重建spfile(spfileorcl.ora)

添加controlfile,重新创建spfile

1.编辑init.ora文件
指定需要添加的控制文件的路径
control_files=("E:\oracle\product\10.1.0\oradata\orcl\control01.ctl", "E:\oracle\product\10.1.0\oradata\orcl\control02.ctl", "E:\oracle\product\10.1.0\oradata\orcl\control03.ctl", "E:\oracle\product\10.1.0\oradata\orcl\control04.ctl","E:\oracle\product\10.1.0\oradata\orcl\control05.ctl")
--添加control04.ctl,control05.ctl的路径
2.创建control04.ctl,control05.ctl文件
E:\oracle\product\10.1.0\admin\orcl\init.ora --添加controlfile
SQL> shutdown--切换状态
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> host copy e:\oracle\product\10.1.0\oradata\orcl\control01.ctl e:\oracle\product\10.1.0\oradata\orcl\control04.ctl
已复制         1 个文件。
SQL> host copy e:\oracle\product\10.1.0\oradata\orcl\control01.ctl e:\oracle\product\10.1.0\oradata\orcl\control05.ctl
已复制         1 个文件。
 
3.使用pflie文件引导oracle启动
--系统首选启动文件e:\oracle\product\10.1.0\Db_1\database\spfileorcl.ora
--管理员无法直接更改spfileorcl.ora文件,只能重新创建
SQL> startup pfile='e:\oracle\product\10.1.0\admin\orcl\pfile\init.ora.7112011153835';
ORACLE instance started.
 
Total System Global Area  171966464 bytes
Fixed Size                   787988 bytes
Variable Size             145488364 bytes
Database Buffers           25165824 bytes
Redo Buffers                 524288 bytes
Database mounted.
Database opened.
--controlfile已经添加成功
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\CONTROL01.CTL
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\CONTROL02.CTL
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\CONTROL03.CTL
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\CONTROL04.CTL
E:\ORACLE\PRODUCT\10.1.0\ORADATA\ORCL\CONTROL05.CTL
SQL>
4.重新创建spfile
--(1)oracle使用pfile登录 open状态创建spfile
SQL> create spfile from pfile='e:\oracle\product\10.1.0\admin\orcl\pfile\init.ora.7112011153835';
File created.
 
--(2)nomount 状态无法创建spflie
--oracle使用pfile登录nomount状态可以创建spfile
SQL> startup nomount
ORACLE instance started.
Total System Global Area  171966464 bytes
Fixed Size                   787988 bytes
Variable Size             145488364 bytes
Database Buffers           25165824 bytes
Redo Buffers                 524288 bytes
SQL> create spfile from pfile='e:\oracle\product\10.1.0\admin\orcl\pfile\init.ora.7112011153835';
create spfile from pfile='e:\oracle\product\10.1.0\admin\orcl\pfile\init.ora.7112011153835'
*
ERROR at line 1:
ORA-32002: cannot create SPFILE already being used by the instance
SQL>
 
--(3)oracle关闭状态创建spfile
SQL> shutdown
ORA-01507: database not mounted
 
ORACLE instance shut down.
SQL> create spfile from pfile='e:\oracle\product\10.1.0\admin\orcl\pfile\init.ora.7112011153835';
File created.
SQL>

猜你喜欢

转载自happyqing.iteye.com/blog/1801069