--------登陆数据库
$ sqlplus /nolog
SQL*Plus: Release 9.2.0.6.0 - Production on Sun Mar 30 12:51:40 2008
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL> conn /as sysdba
Connected.
------查看日志文件位置
SQL> select * from v$logfile;
GROUP# STATUS TYPE
---------- ------- -------
MEMBER
--------------------------------------------------------------------------------
2 ONLINE
/data/prod/proddata/log02a.dbf
2 ONLINE
/data/prod/proddata/log02b.dbf
1 ONLINE
/data/prod/proddata/log01a.dbf
GROUP# STATUS TYPE
---------- ------- -------
MEMBER
--------------------------------------------------------------------------------
1 ONLINE
/data/prod/proddata/log01b.dbf
3 ONLINE
/data/prod/proddata/log03a.dbf
3 ONLINE
/data/prod/proddata/log03b.dbf
6 rows selected.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61560 10485760 2 YES INACTIVE
892788389 30-MAR-08
2 1 61561 10485760 2 YES INACTIVE
892809974 30-MAR-08
3 1 61562 10485760 2 NO CURRENT
892834999 30-MAR-08
---------增加两个日志文件组45
SQL> alter database add logfile group 4 ('/data/prod/proddata/log04a.dbf') size 20m;
Database altered.
SQL> alter database add logfile group 5 ('/data/prod/proddata/log05a.dbf') size 20m;
Database altered.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61563 10485760 2 NO CURRENT
892859198 30-MAR-08
2 1 61561 10485760 2 YES INACTIVE
892809974 30-MAR-08
3 1 61562 10485760 2 YES ACTIVE
892834999 30-MAR-08
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
4 1 0 20971520 1 YES UNUSED
0
5 1 0 20971520 1 YES UNUSED
0
----------切换到新建日志组
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61563 10485760 2 YES INACTIVE
892859198 30-MAR-08
2 1 61561 10485760 2 YES INACTIVE
892809974 30-MAR-08
3 1 61562 10485760 2 YES INACTIVE
892834999 30-MAR-08
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
4 1 61564 20971520 1 YES INACTIVE
892862206 30-MAR-08
5 1 61565 20971520 1 NO CURRENT
892862208 30-MAR-08
--------删除日志文件组123
SQL> alter database drop logfile group 1;
Database altered.
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
4 1 61564 20971520 1 YES INACTIVE
892862206 30-MAR-08
5 1 61565 20971520 1 NO CURRENT
892862208 30-MAR-08
----------新建日志文件组123
SQL> alter database add logfile group 1 ('/data/prod/proddata/log01a.dbf','/data/prod/proddata/log01b.dbf') size 20M;
Database altered.
SQL> alter database add logfile group 2 ('/data/prod/proddata/log02a.dbf','/data/prod/proddata/log02b.dbf') size 20M;
Database altered.
SQL> alter database add logfile group 3 ('/data/prod/proddata/log03a.dbf','/data/prod/proddata/log03b.dbf') size 20M;
Database altered.
----------查看日志文件组状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 0 20971520 2 YES UNUSED
0
2 1 0 20971520 2 YES UNUSED
0
3 1 0 20971520 2 YES UNUSED
0
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
4 1 61564 20971520 1 YES INACTIVE
892862206 30-MAR-08
5 1 61565 20971520 1 NO CURRENT
892862208 30-MAR-08
----------切换日志文件
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> alter system switch logfile;
System altered.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61566 20971520 2 YES INACTIVE
892864847 30-MAR-08
2 1 61567 20971520 2 YES INACTIVE
892864849 30-MAR-08
3 1 61568 20971520 2 NO CURRENT
892864851 30-MAR-08
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
4 1 61564 20971520 1 YES INACTIVE
892862206 30-MAR-08
5 1 61565 20971520 1 YES INACTIVE
892862208 30-MAR-08
-----------删除日志文件组45
SQL> alter database drop logfile group 4;
Database altered.
SQL> alter database drop logfile group 5;
Database altered.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61566 20971520 2 YES INACTIVE
892864847 30-MAR-08
2 1 61567 20971520 2 YES INACTIVE
892864849 30-MAR-08
3 1 61568 20971520 2 NO CURRENT
892864851 30-MAR-08
---------------------重新启动数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 2016375704 bytes
Fixed Size 734104 bytes
Variable Size 1006632960 bytes
Database Buffers 1006632960 bytes
Redo Buffers 2375680 bytes
Database mounted.
Database opened.
----------查看日志文件状态
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
1 1 61566 20971520 2 YES INACTIVE
892864847 30-MAR-08
2 1 61567 20971520 2 YES INACTIVE
892864849 30-MAR-08
3 1 61568 20971520 2 NO CURRENT
892864851 30-MAR-08
-------------备份控制文件
SQL> alter database backup controlfile to '/data/prod/orabak/controlfile_bak_080330.bak' ;
Database altered.
SQL> alter database backup controlfile to trace resetlogs;
Database altered.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10756358/viewspace-220317/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10756358/viewspace-220317/