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