Oracle cold backup ---- Delete non-system tablespace

Source: Internet
Author: User

1. Backup File

Define fil =/home/Oracle/cdbk. SQL
Define log =/home/oracle/cdbk. log
Spool & fil
Prompt connet sys/sysdba @ asmdemo as sysdba;
Prompt shutdown immediate;
Select 'host cp' | file_name | '/u01/asmdemo' | substr (file_name, instr (file_name, '/',-1, 1) from dba_data_fi
Les;
Prompt startup;
Spool off
Spool & log
@ & Fil;
Spool off

2. Create a user

Create user test identified by test default tablespace ts_test;

Create table t1 ase select * from dba_objects where rownum = 1

3. Delete non-system tablespace

Select file_name, file_id from dba_data_files;

/U01/app/oracle/oradata/demo/users01.dbf 1

/U01/app/oracle/oradata/demo/sysaux01.dbf 2
/U01/app/oracle/oradata/demo/undotbs01.dbf 3

/U01/app/oracle/oradata/demo/system01.dbf 4
/U01/app/oracle/oradata/demo/ts_test01.dbf 5

Rm-f/u01/app/oracle/oradata/demo/ts_test01.dbf

4. An error is returned when querying table t1.

Select * from t1

5. Restore data files online

Alter tablespace ts_test online

6. Restore data files

Recover datafile 5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.