Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of adding and deleting files in rman

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the method of adding and deleting files in rman". In the daily operation, I believe that many people have doubts about the method of adding and deleting files in rman. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "what is the method of adding and deleting files in rman?" Next, please follow the editor to study!

I add control file

We wrote above: the control file should be placed on three different disks, and at least two should be guaranteed.

1 View control file properties

SQL > show parameter control

NAME TYPE VALUE

-

Control_file_record_keep_time integer 7

Control_files string / home/oracle/cs/control01.ctl

Control_management_pack_access string DIAGNOSTIC+TUNING

2. To add 02.ctl is to modify the parameter value.

SQL > alter system set control_files='/home/oracle/cs/control01.ctl','/ooradata/test1/control02.dbf' scope=spfile

System altered.

3 shutdown, underlying replication

SQL > shutdown immediate

[oracle@jcy1 test1] $cp / home/oracle/cs/control01.ctl / ooradata/test1/control02.ctl

-- be sure to correspond to the path of the control_files parameter

4 boot verification

SQL > startup

SQL > select name from v$controlfile

NAME

-

/ home/oracle/cs/control01.ctl

/ ooradata/test1/control02.ctl

The third control file, similarly

5. Delete control files

Like before, I need to generate pfile in the parameter file, delete * .control _ files=, and regenerate it into spfile, which is troublesome, and now I can add

SQL > alter system set control_files='/home/oracle/cs/control01.ctl' scope=spfile

System altered.

Specify only one 01.ctlrec 02.ctl and it is deleted.

Shutdown

SQL > shutdown immediate

Boot verification

SQL > startup

SQL > select name from v$controlfile

NAME

-

/ home/oracle/cs/control01.ctl

II add log file

1 View log file

SQL > select * from v$logfile

GROUP# STATUS TYPE MEMBER IS_

-

3 ONLINE / home/oracle/cs/redo03.log NO

2 ONLINE / home/oracle/cs/redo02.log NO

1 ONLINE / home/oracle/cs/redo01.log NO

View logs for more details

SQL > select * from v$log

GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME

-

1 1 1 52428800 512 1 NO CURRENT 933509 02-FEB-20 2.8147E+14

2 1 0 52428800 512 1 YES UNUSED 00

3 1 0 52428800 512 1 YES UNUSED 00

2 add log groups (logs have the concept of groups and members)

SQL > alter database add logfile group 4'/ home/oracle/cs/redo04.log' size 100m

Database altered.

-- add log group 4 and add a 04 member

Add member 05 to group 4

SQL > alter database add logfile member'/ home/oracle/cs/redo05.log' to group 4

Database altered.

Verification

SQL > select * from v$logfile

GROUP# STATUS TYPE MEMBER IS_

-

3 ONLINE / home/oracle/cs/redo03.log NO

2 ONLINE / home/oracle/cs/redo02.log NO

1 ONLINE / home/oracle/cs/redo01.log NO

4 ONLINE / home/oracle/cs/redo04.log NO

4 INVALID ONLINE / home/oracle/cs/redo05.log NO

3 delete log group

SQL > alter database drop logfile group 4

Database altered.

Verification

SQL > select * from v$logfile

GROUP# STATUS TYPE MEMBER IS_

-

3 ONLINE / home/oracle/cs/redo03.log NO

2 ONLINE / home/oracle/cs/redo02.log NO

1 ONLINE / home/oracle/cs/redo01.log NO

Note: if you also want to add log group 5, group member 04.log, an error will be prompted because the underlying 04 member has not been deleted

[oracle@jcy1 test1] $cd / home/oracle/cs

[oracle@jcy1 cs] $ls-l redo04.log

-rw-r- 1 oracle dba 104858112 Feb 2 11:01 redo04.log

So delete the bottom 04.

[oracle@jcy1 cs] $rm-rf redo04.log

4 continue to delete log group 4 (I added group 4 later) to ensure the existence of at least two groups of logs

SQL > alter database drop logfile group 4

Alter database drop logfile group 4

*

ERROR at line 1:

ORA-01623: log 4 is current log for instance test1 (thread 1)-cannot drop

ORA-00312: online log 4 thread 1:'/ home/oracle/cs/redo04.log'

-- prompt that you are in use, so check the log status

SQL > select GROUP#,SEQUENCE#,STATUS from v$log

GROUP# SEQUENCE# STATUS

1 1 ACTVE

2 2 INACTIVE

3 3 INACTIVE

4 4 CURRENT

Solution 1: cut and file

SQL > alter system archive log current

Check the status, delete again, and if it still cannot be deleted, cut the archive again until you are in INACTIVE

Method 2: create a checkpoint

SQL > alter system checkpoint

SQL > alter system switch logfile

Check the status before deleting

III add data File

1 View log file

SQL > select name from v$datafile

NAME

-

/ ooradata/test1/system01.dbf

/ ooradata/test1/sysaux01.dbf

/ ooradata/test1/undotbs01.dbf

/ ooradata/test1/users01.dbf

View tablespace

SQL > select name from v$tablespace

NAME

-

SYSTEM

SYSAUX

UNDOTBS1

USERS

TEMP

Query data file dictionary

SQL > select FILE_NAME,FILE_ID,TABLESPACE_NAME,BYTES/1024/1024 M from dba_data_files

Query tablespace dictionary

SQL > desc dba_tablespaces

2 add a system02.dbf file to the SYSTEM tablespace

SQL > alter tablespace SYSTEM add datafile'/ ooradata/test1/system02.dbf' size 200m

Tablespace altered.

Verification

SQL > select name from v$datafile

NAME

-

/ ooradata/test1/system01.dbf

/ ooradata/test1/sysaux01.dbf

/ ooradata/test1/undotbs01.dbf

/ ooradata/test1/users01.dbf

/ ooradata/test1/system02.dbf

3 find the sum size of SYSTEM table space

SQL > select TABLESPACE_NAME,sum (BYTES/1024/1024) m from dba_data_files group by TABLESPACE_NAME

TABLESPACE_NAME M

UNDOTBS1 30

SYSAUX 490

USERS 5

SYSTEM 940

If the table space is too large, you can add the filter condition having TABLESPACE_NAME='SYSTEM'

4 modify the data file size

I) check the size first

SQL > select FILE_NAME,BYTES/1024/1024 m from dba_data_files

FILE_NAME M

--

/ ooradata/test1/users01.dbf 5

/ ooradata/test1/undotbs01.dbf 30

/ ooradata/test1/sysaux01.dbf 490

/ ooradata/test1/system01.dbf 740

/ ooradata/test1/system02.dbf 200

Ii) modify the size

SQL > alter database datafile'/ ooradata/test1/system02.dbf' resize 220m

Database altered.

Iii) Verification

SQL > select FILE_NAME,BYTES/1024/1024 m from dba_data_files

FILE_NAME M

--

/ ooradata/test1/users01.dbf 5

/ ooradata/test1/undotbs01.dbf 30

/ ooradata/test1/sysaux01.dbf 490

/ ooradata/test1/system01.dbf 740

/ ooradata/test1/system02.dbf 220

5 check how much tablespace is used

Idea: total-idle = used

SQL > desc dba_free_space

Select zmurc, a.TABLESPACE_NAME from-- subtract, and you get the

-- query total size

(select sum (BYTES/1024/1024) z, TABLESPACE_NAME from dba_data_files group by TABLESPACE_NAME) a

-- query the remaining size

(select sum (BYTES/1024/1024) c, TABLESPACE_NAME from dba_free_space group by TABLESPACE_NAME) b

Where a. TABLESPACE_NAME=b. TABLESPACE_NAME

At this point, the study on "what is the method of adding and deleting files by rman" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report