什么技术不玩就会陌生,ORACLE控制文件举足轻重,接下来写一篇如何为ORACLE增加控制文件的文章。
首先查看当前控制文件的信息:
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/oradata/sansom/control01.
ctl, /u01/oradata/sansom/contr
ol02.ctl, /u01/oradata/sansom/
control03.ctl
目前控制文件有3个,接下来我们用创建PFILE直接修改PFILE文件内容的方法增加控制文件,并放在不同的路径
[oracle@gard3 dbs]$ pwd
/u01/oracle/dbs
[oracle@gard3 dbs]$ ll
-rw-r----- 1 oracle oinstall 1536 Nov 4 08:45 orapwsansom
-rw-r----- 1 oracle oinstall 2560 Nov 22 03:23 spfilesansom.ora
目前/u01/oracle/dbs并没有PFILE文件,我们来创建它
SQL> create pfile from spfile;
File created.
SQL> !
[oracle@gard3 dbs]$ ll
total 76
-rw-r--r-- 1 oracle oinstall 974 Nov 22 03:36 initsansom.ora
-rw-r----- 1 oracle oinstall 1536 Nov 4 08:45 orapwsansom
-rw-r----- 1 oracle oinstall 2560 Nov 22 03:23 spfilesansom.ora
打开initsansom.ora文件直接添加'/u01/oradata/backup/control04.ctl',并保存
sansom.__db_cache_size=176160768
sansom.__java_pool_size=4194304
sansom.__large_pool_size=4194304
sansom.__shared_pool_size=92274688
sansom.__streams_pool_size=4194304
*.audit_file_dest='/u01/admin/sansom/adump'
*.background_dump_dest='/u01/admin/sansom/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/u01/oradata/sansom/control01.ctl','/u01/oradata/sansom/control02.ctl','/u01/oradata/sansom/control03.ctl','/u01/oradata/backup/control04.ctl'
*.core_dump_dest='/u01/admin/sansom/cdump'
*.db_block_size=8192
拷贝任意一个控制文件到backup目录下,并关闭数据库:
[oracle@gard3 dbs]$ cp /u01/oradata/sansom/control01.ctl /u01/oradata/backup/control04.ctl
[oracle@gard3 dbs]$ exit
exit
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
使用pfile重新启动数据库:
SQL> startup pfile='/u01/oracle/dbs/initsansom.ora'
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 104859216 bytes
Database Buffers 176160768 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/oradata/sansom/control01.
ctl, /u01/oradata/sansom/contr
ol02.ctl, /u01/oradata/sansom/
control03.ctl, /u01/oradata/ba
ckup/control04.ctl
SQL>
增加成功,可以删除老的spfile,用现在的pfile来创建spfile,控制文件添加完毕!