Get the App
SLTechnology News&Howtos  ›  Database  › 

Oracle online rename data file

Shulou Source: shulou.com Published: 2022-06-01 05:03:15 10月02日 Update

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

Tags: Data file schema database status time query online careless operating system lieutenant general method name backup carelessness blank space system error problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB NVidia OPPO Reno MySQL Huawei