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

Oracle online rename data file

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Today, when adding data files to the tablespace, carelessly added an extra space, in order to avoid later backup and other problems. Now prepare the online rename data file. First test SQL > create tablespace test datafile'/ home/oracle/tst.dbf 'size 1m; Tablespace created on the test library. Confirm whether it is archived mode SQL > archivelog list Database log mode Archive Mode Automatic archival Enabled Archive destination / archive/archive1 Oldest online log sequence 109 Next log sequence to archive 111111If it is not archived mode, you need to start the database to mount state and change the database to archived mode SQL > alter database archivelog;. You may encounter ora-00265 error at this time! The solution is to start the database in restricted mode, and then restart to mount state SQL > startup restrict When the database is in archive mode, the online rename operation can be performed: 1 query the file number of datafile SQL > select file_id,file_name from dba_data_files where tablespace_name='TEST' FILE_ID FILE_NAME-13 / home/oracle/tst.dbf 2. Change the data file offline SQL > alter database datafile 13 offline; Database altered 3. Modify the file name in the operating system: SQL > host mv'/ home/oracle/tst.dbf' / home/oracle/tst.dbf 4rename data file SQL > alter database rename file'/ home/oracle/tst.dbf' to'/ home/oracle/tst.dbf'; Database altered. 5. Restore the data file and online SQL > recover datafile 13; Media recovery complete. SQL > alter database datafile 13 online Database altered 6. Query data file status SQL > select file_id,file_name,status from dba_data_files where tablespace_name='TEST' FILE_ID FILE_NAME STATUS-13 / home/oracle/tst.dbf AVAILABLE

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