导读
本文介绍如何查看控制文件的内容
可以通过下面两种方法查看控制文件的内容
- 使用strings命令查看
- 使用视图v$controlfile_record_session查看
- 转储控制文件到一个文本文件,然后查看文本文件的内容
1、使用strings命令查看控制文件内容
strings <控制文件名>
[oracle@db11g ~]$ strings /u01/app/oracle/oradata/PROD11G/control01.ctl
}|{z
PROD11G
BPROD11G
BPROD11G
PROD11G
m*EE
PROD11G
m*EE7N.
m*EE
IL9E
m*EE7N.
m*EE~
m*EE
m*EE
m*EE
m*EE
m*EE
m*EEl
m*EEl
m*EEl
m*EEl
m*EEl
m*EEl
m*EE"
/u01/app/oracle/oradata/PROD11G/redo03.log
/u01/app/oracle/oradata/PROD11G/redo02.log
/u01/app/oracle/oradata/PROD11G/redo01.log
/u01/app/oracle/oradata/PROD11G/users01.dbf
/u01/app/oracle/oradata/PROD11G/undotbs01.dbf
/u01/app/oracle/oradata/PROD11G/sysaux01.dbf
/u01/app/oracle/oradata/PROD11G/system01.dbf
/u01/app/oracle/oradata/PROD11G/temp01.dbf
/u01/app/oracle/oradata/PROD11G/example01.dbf
/u01/app/oracle/oradata/PROD11G/users02.dbf
/u01/app/oracle/oradata/PROD11G/system02.dbf
/u01/app/oracle/oradata/PROD11G/sysaux02.dbf
/u01/app/oracle/oradata/PROD11G/undotbs02.dbf
/u01/app/oracle/oradata/PROD11G/lzy01.dbf
/u01/app/oracle/oradata/PROD11G/lzy02.dbf
/u01/app/oracle/oradata/PROD11G/redo03.log
/u01/app/oracle/oradata/PROD11G/redo02.log
/u01/app/oracle/oradata/PROD11G/redo01.log
/u01/app/oracle/oradata/PROD11G/users01.dbf
/u01/app/oracle/oradata/PROD11G/undotbs01.dbf
/u01/app/oracle/oradata/PROD11G/sysaux01.dbf
/u01/app/oracle/oradata/PROD11G/system01.dbf
/u01/app/oracle/oradata/PROD11G/temp01.dbf
/u01/app/oracle/oradata/PROD11G/example01.dbf
/u01/app/oracle/oradata/PROD11G/users02.dbf
/u01/app/oracle/oradata/PROD11G/system02.dbf
/u01/app/oracle/oradata/PROD11G/sysaux02.dbf
/u01/app/oracle/oradata/PROD11G/undotbs02.dbf
/u01/app/oracle/oradata/PROD11G/lzy01.dbf
/u01/app/oracle/oradata/PROD11G/lzy02.dbf
/u01/app/oracle/oradata/PROD11G/cbo01.dbf
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
SYSTEM
SYSAUX
UNDOTBS1
USERS
TEMP
EXAMPLE
Bg]$
B"u3
C8EC
"CnwL
;CPPY
mpUC
mpUCh
C5`f
C)bi
-E*D
/3.D
-E*D
/3.D
5D`q
bY=D
bY=D
'{ZD
'{ZD
pbbD
pbbDqQ
eDK!{mD{mD
{U}D
zU}Dt5;
DRWX
DH!{
IL9E
3E7N.
IL9E
m*EE
Bg]$
B"u3
C8EC
"CnwL
;CPPY
mpUC
mpUCh
C5`f
C)bi
-E*D
/3.D
-E*D
/3.D
5D`q
bY=D
bY=D
'{ZD
'{ZD
pbbD
pbbDqQ
eDK!{mD{mD
{U}D
zU}Dt5;
DRWX
DH!{
IL9E
3E7N.
IL9E
m*EE
m*EE~
u01/app/oracle/oradata/PROD11G/example01.dbf
/u01/app/oracle/oradata/PROD11G/example01.dbf
PROD11G
PROD11G
PROD11G
UNNAMED_INSTANCE_2
UNNAMED_INSTANCE_3
UNNAMED_INSTANCE_4
UNNAMED_INSTANCE_5
UNNAMED_INSTANCE_6
UNNAMED_INSTANCE_7
UNNAMED_INSTANCE_8
PROD11G
UNNAMED_INSTANCE_2
UNNAMED_INSTANCE_3
UNNAMED_INSTANCE_4
UNNAMED_INSTANCE_5
UNNAMED_INSTANCE_6
UNNAMED_INSTANCE_7
UNNAMED_INSTANCE_8
ACM unit testing operation
LSB Database Guard
Supplemental Log Data DDL
LSB Role Change Support
RFS block and kill across RAC
RAC-wide SGA
ACM unit testing operation
LSB Database Guard
Supplemental Log Data DDL
LSB Role Change Support
RFS block and kill across RAC
RAC-wide SGA
2、使用视图v$controlfile_record_session查看
查询视图v$controlfile_record_session中的相关列
SQL>select type,record_size,records_total,records_used from v$controlfile_record_section;
SYS@PROD11G> select controlfile_sequence# from v$database;CONTROLFILE_SEQUENCE#
---------------------209188SYS@PROD11G> select type,record_size,records_total,records_used from v$controlfile_record_section;TYPE RECORD_SIZE RECORDS_TOTAL RECORDS_USED
---------------------------- ----------- ------------- ------------
DATABASE 316 1 1
CKPT PROGRESS 8180 11 0
REDO THREAD 256 8 1
REDO LOG 72 16 3
DATAFILE 520 100 12
FILENAME 524 2298 16
TABLESPACE 68 100 8
TEMPORARY FILENAME 56 100 1
RMAN CONFIGURATION 1108 50 0
LOG HISTORY 56 292 137
OFFLINE RANGE 200 163 0
ARCHIVED LOG 584 28 0
BACKUP SET 40 409 0
BACKUP PIECE 736 200 0
BACKUP DATAFILE 200 245 0
BACKUP REDOLOG 76 215 0
DATAFILE COPY 736 200 1
BACKUP CORRUPTION 44 371 0
COPY CORRUPTION 40 409 0
DELETED OBJECT 20 818 1
PROXY COPY 928 246 0
BACKUP SPFILE 124 131 0
DATABASE INCARNATION 56 292 2
FLASHBACK LOG 84 2048 0
RECOVERY DESTINATION 180 1 0
INSTANCE SPACE RESERVATION 28 1055 1
REMOVABLE RECOVERY FILES 32 1000 0
RMAN STATUS 116 141 0
THREAD INSTANCE NAME MAPPING 80 8 8
MTTR 100 8 1
DATAFILE HISTORY 568 57 0
STANDBY DATABASE MATRIX 400 31 31
GUARANTEED RESTORE POINT 212 2048 0
RESTORE POINT 212 2083 0
DATABASE BLOCK CORRUPTION 80 8384 0
ACM OPERATION 104 64 6
FOREIGN ARCHIVED LOG 604 1002 037 rows selected.SYS@PROD11G>
3、转储控制文件到一个文本文件
使用alter database backup controlfile命令转储一个控制文件
SQL>alter database backup controlfile to trace as ‘/home/oracle/control.sql’;
SYS@PROD11G> alter database backup controlfile to trace as '/home/oracle/control.sql';Database altered.SYS@PROD11G> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options[oracle@db11g ~]$ cat control.sql
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="PROD11G"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=4
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/product/11g/dbhome_1/dbs/arch'
-- LOG_ARCHIVE_DEST_1='MANDATORY NOREOPEN NODELAY'
-- LOG_ARCHIVE_DEST_1='ARCH NOAFFIRM EXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_1='NOREGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_1='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_1='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_1=ENABLE--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCESTARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD11G" NORESETLOGS NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 '/u01/app/oracle/oradata/PROD11G/redo01.log' SIZE 500M BLOCKSIZE 512,GROUP 2 '/u01/app/oracle/oradata/PROD11G/redo02.log' SIZE 500M BLOCKSIZE 512,GROUP 3 '/u01/app/oracle/oradata/PROD11G/redo03.log' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE'/u01/app/oracle/oradata/PROD11G/system01.dbf','/u01/app/oracle/oradata/PROD11G/sysaux01.dbf','/u01/app/oracle/oradata/PROD11G/undotbs01.dbf','/u01/app/oracle/oradata/PROD11G/users01.dbf','/u01/app/oracle/oradata/PROD11G/example01.dbf','/u01/app/oracle/oradata/PROD11G/users02.dbf','/u01/app/oracle/oradata/PROD11G/system02.dbf','/u01/app/oracle/oradata/PROD11G/sysaux02.dbf','/u01/app/oracle/oradata/PROD11G/undotbs02.dbf','/u01/app/oracle/oradata/PROD11G/lzy01.dbf','/u01/app/oracle/oradata/PROD11G/lzy02.dbf','/u01/app/oracle/oradata/PROD11G/cbo01.dbf'
CHARACTER SET AL32UTF8
;-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11g/dbhome_1/dbs/arch1_1_824297850.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11g/dbhome_1/dbs/arch1_1_1118659776.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE-- Database can now be opened normally.
ALTER DATABASE OPEN;-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/PROD11G/temp01.dbf'SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
-- Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCESTARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD11G" RESETLOGS NOARCHIVELOGMAXLOGFILES 16MAXLOGMEMBERS 3MAXDATAFILES 100MAXINSTANCES 8MAXLOGHISTORY 292
LOGFILEGROUP 1 '/u01/app/oracle/oradata/PROD11G/redo01.log' SIZE 500M BLOCKSIZE 512,GROUP 2 '/u01/app/oracle/oradata/PROD11G/redo02.log' SIZE 500M BLOCKSIZE 512,GROUP 3 '/u01/app/oracle/oradata/PROD11G/redo03.log' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE'/u01/app/oracle/oradata/PROD11G/system01.dbf','/u01/app/oracle/oradata/PROD11G/sysaux01.dbf','/u01/app/oracle/oradata/PROD11G/undotbs01.dbf','/u01/app/oracle/oradata/PROD11G/users01.dbf','/u01/app/oracle/oradata/PROD11G/example01.dbf','/u01/app/oracle/oradata/PROD11G/users02.dbf','/u01/app/oracle/oradata/PROD11G/system02.dbf','/u01/app/oracle/oradata/PROD11G/sysaux02.dbf','/u01/app/oracle/oradata/PROD11G/undotbs02.dbf','/u01/app/oracle/oradata/PROD11G/lzy01.dbf','/u01/app/oracle/oradata/PROD11G/lzy02.dbf','/u01/app/oracle/oradata/PROD11G/cbo01.dbf'
CHARACTER SET AL32UTF8
;-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11g/dbhome_1/dbs/arch1_1_824297850.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/product/11g/dbhome_1/dbs/arch1_1_1118659776.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/PROD11G/temp01.dbf'SIZE 30408704 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
[oracle@db11g ~]$