Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2783349
  • 博文数量: 423
  • 博客积分: 7770
  • 博客等级: 少将
  • 技术积分: 4766
  • 用 户 组: 普通用户
  • 注册时间: 2006-11-09 11:58
个人简介

Oracle/DB2/Postgresql/Mysql/Hadoop/Greenplum/Postgres-xl/Mongodb

文章分类

全部博文(423)

文章存档

2019年(3)

2018年(6)

2017年(27)

2016年(23)

2015年(30)

2014年(16)

2013年(31)

2012年(73)

2011年(45)

2010年(14)

2009年(30)

2008年(30)

2007年(63)

2006年(32)

分类: Oracle

2012-06-09 11:03:39


                                                 l
SQL> show parameter control             // 查找初始化参数中control files

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      /u01/oracle/oradata/ora9i/cont
                                                 rol01.ctl, /u01/oracle/oradata
                                                 /ora9i/control02.ctl, /u01/ora
                                                 cle/oradata/ora9i/control03.ct
                                                 l
SQL>

SQL> alter system set control_files='/u01/oracle/oradata/ora9i/control01.ctl', '/u01/oracle/oradata/ora9i/control02.ctl','/u01/oracle/oradata/ora9i/control03.ctl', '/u02/oradata/ora9i/control04.ctl' scope=spfile;

System altered.

//新增控制文件到/u02分区

[Oracle@ora9i ~]$ cp  /u01/oracle/oradata/ora9i/control01.ctl  /u02/oradata/ora9i/control04.ctl


SQL> shutdown immediate;


SQL> startup;


SQL> select name from v$controlfile;

NAME
------------------------------------------------------------
/u01/oracle/oradata/ora9i/control01.ctl
/u01/oracle/oradata/ora9i/control02.ctl
/u01/oracle/oradata/ora9i/control03.ctl
/u02/oradata/ora9i/control04.ctl

SQL>




#######Maintaining  online redo logfile



SQL> desc v$log
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 GROUP#                                             NUMBER
 THREAD#                                            NUMBER
 SEQUENCE#                                          NUMBER
 BYTES                                              NUMBER
 MEMBERS                                            NUMBER
 ARCHIVED                                           VARCHAR2(3)
 STATUS                                             VARCHAR2(16)
 FIRST_CHANGE#                                      NUMBER
 FIRST_TIME                                         DATE

SQL> select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1         20 CURRENT
         2          1         18 INACTIVE
         3          1         19 INACTIVE

SQL>


SQL> alter system switch logfile;

System altered.

SQL> select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1         20 ACTIVE
         2          1         21 CURRENT
         3          1         19 INACTIVE

SQL> alter system switch logfile;

System altered.

SQL> select group#,thread#,sequence#,status from v$log;

    GROUP#    THREAD#  SEQUENCE# STATUS
---------- ---------- ---------- ----------------
         1          1         20 INACTIVE
         2          1         21 ACTIVE
         3          1         22 CURRENT

SQL>



SQL> alter system set fast_start_mttr_target=600 scope=both;

System altered.

SQL> show parameter fast

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fast_start_io_target                 integer     0
fast_start_mttr_target               integer     600
fast_start_parallel_rollback         string      LOW
SQL>


SQL> alter system checkpoint;

System altered.

SQL>


SQL> select  GROUP#,STATUS,type,MEMBER from v$logfile;

    GROUP# STATUS  TYPE    MEMBER
---------- ------- ------- --------------------------------------------------
         3         ONLINE  /u01/oracle/oradata/ora9i/redo03.log
         2         ONLINE  /u01/oracle/oradata/ora9i/redo02.log
         1         ONLINE  /u01/oracle/oradata/ora9i/redo01.log




SQL> alter database add logfile group 4
  2  ('/u01/oracle/oradata/ora9i/redo04.log') size 50M;

Database altered.

SQL> !
[oracle@ora9i ora9i]$ lll
bash: lll: command not found
[oracle@ora9i ora9i]$ ll
total 1246516
-rw-r-----  1 oracle oinstall   1871872 Apr 29 06:18 control01.ctl
-rw-r-----  1 oracle oinstall   1871872 Apr 29 06:18 control02.ctl
-rw-r-----  1 oracle oinstall   1871872 Apr 29 06:18 control03.ctl
-rw-r--r--  1 oracle oinstall  20975616 Apr 29 06:09 drsys01.dbf
-rw-r--r--  1 oracle oinstall 152702976 Apr 29 06:09 example01.dbf
-rw-r--r--  1 oracle oinstall  26218496 Apr 29 06:09 indx01.dbf
-rw-r--r--  1 oracle oinstall  20975616 Apr 29 06:09 odm01.dbf
-rw-r-----  1 oracle oinstall 104858112 Apr 29 05:57 redo01.log
-rw-r-----  1 oracle oinstall 104858112 Apr 29 05:57 redo02.log
-rw-r-----  1 oracle oinstall 104858112 Apr 29 06:18 redo03.log
-rw-r-----  1 oracle oinstall  52429312 Apr 29 06:18 redo04.log
-rw-r--r--  1 oracle oinstall 346034176 Apr 29 06:09 system01.dbf
-rw-r--r--  1 oracle oinstall  41947136 Aug 22  2011 temp01.dbf
-rw-r--r--  1 oracle oinstall  10489856 Apr 29 06:09 tools01.dbf
-rw-r--r--  1 oracle oinstall 209719296 Apr 29 06:09 undotbs01.dbf
-rw-r--r--  1 oracle oinstall  26218496 Apr 29 06:09 users01.dbf
-rw-r--r--  1 oracle oinstall  47190016 Apr 29 06:09 xdb01.dbf
[oracle@ora9i ora9i]$



SQL> alter database add logfile member
  2  '/u01/oracle/oradata/ora9i/redo04a.log' to group 4;

Database altered.

SQL> select  GROUP#,STATUS,MEMBER from v$logfile;

    GROUP# STATUS  MEMBER
---------- ------- --------------------------------------------------
         3         /u01/oracle/oradata/ora9i/redo03.log
         2         /u01/oracle/oradata/ora9i/redo02.log
         1         /u01/oracle/oradata/ora9i/redo01.log
         4         /u01/oracle/oradata/ora9i/redo04.log
         4 INVALID /u01/oracle/oradata/ora9i/redo04a.log

SQL>



###drop logfile group######


SQL> alter database drop logfile group 4;
alter database drop logfile group 4
*
ERROR at line 1:
ORA-01624: log 4 needed for crash recovery of thread 1
ORA-00312: online log 4 thread 1: '/u01/oracle/oradata/ora9i/redo04.log'
ORA-00312: online log 4 thread 1: '/u01/oracle/oradata/ora9i/redo04a.log'


SQL> select group#,members,archived,status from v$log;

    GROUP#    MEMBERS ARC STATUS
---------- ---------- --- ----------------
         1          1 NO  CURRENT
         2          1 NO  INACTIVE
         3          1 NO  INACTIVE
         4          2 NO  ACTIVE

SQL> alter system switch logfile;

System altered.

SQL> select group#,members,archived,status from v$log;

    GROUP#    MEMBERS ARC STATUS
---------- ---------- --- ----------------
         1          1 NO  ACTIVE
         2          1 NO  CURRENT
         3          1 NO  INACTIVE
         4          2 NO  INACTIVE

SQL> alter database drop logfile group 4;

Database altered.

SQL>

#################rename logfile##########################



[oracle@ora9i oradata]$ mkdir rebolog
[oracle@ora9i oradata]$ cp /u01/oracle/oradata/ora9i/redo03.log  /u02/oradata/rebolog/
[oracle@ora9i oradata]$ cd /u02/oradata/rebolog/
[oracle@ora9i rebolog]$ ll


SQL> startup mount;
ORACLE instance started.

Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.



SQL> alter database rename file
  2  '/u01/oracle/oradata/ora9i/redo03.log'
  3  to '/u02/oradata/rebolog/redo03.log';

Database altered.

SQL> alter database open;

Database altered.



SQL> select group#,status,member from v$logfile;

    GROUP# STATUS  MEMBER
---------- ------- ------------------------------------------------------------
         3 STALE   /u02/oradata/rebolog/redo03.log
         2         /u01/oracle/oradata/ora9i/redo02.log
         1         /u01/oracle/oradata/ora9i/redo01.log

SQL> select group#,members,archived,status from v$log;

    GROUP#    MEMBERS ARC STATUS
---------- ---------- --- ----------------
         1          1 NO  INACTIVE
         2          1 NO  CURRENT
         3          1 NO  INACTIVE

SQL>



#################redo logfile configuration ###################################

阅读(995) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~