Oracle控制文件control file(2)查看控制文件内容的三中方法

导读

本文介绍如何查看控制文件的内容

可以通过下面两种方法查看控制文件的内容

  • 使用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#
---------------------
               209188

SYS@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            0

37 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 PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD11G" NORESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 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 PERFORMANCE

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "PROD11G" RESETLOGS  NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 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 ~]$
相关推荐
阿蒙Amon3 小时前
C# Linq to SQL:数据库编程的解决方案
数据库·c#·linq
互联网搬砖老肖7 小时前
运维打铁: MongoDB 数据库集群搭建与管理
运维·数据库·mongodb
典学长编程7 小时前
数据库Oracle从入门到精通!第四天(并发、锁、视图)
数据库·oracle
积跬步,慕至千里8 小时前
clickhouse数据库表和doris数据库表迁移starrocks数据库时建表注意事项总结
数据库·clickhouse
极限实验室8 小时前
搭建持久化的 INFINI Console 与 Easysearch 容器环境
数据库
白仑色9 小时前
Oracle PL/SQL 编程基础详解(从块结构到游标操作)
数据库·oracle·数据库开发·存储过程·plsql编程
程序猿小D10 小时前
[附源码+数据库+毕业论文]基于Spring+MyBatis+MySQL+Maven+jsp实现的个人财务管理系统,推荐!
java·数据库·mysql·spring·毕业论文·ssm框架·个人财务管理系统
钢铁男儿11 小时前
C# 接口(什么是接口)
java·数据库·c#
__风__12 小时前
PostgreSQL kv(jsonb)存储
数据库·postgresql
轩情吖12 小时前
Qt的第一个程序(2)
服务器·数据库·qt·qt creator·qlineedit·hello world·编辑框