Oracle 11g Manual hot spare-table space

Source: Internet
Author: User

Manual hot-Standby must be in the archive mode, read-only table space can not be hot-spare, temporary table space does not need to prepare.

[email protected]> archive log list;——开启了归档Database log mode          Archive ModeAutomatic archival         EnabledArchive destination        /u01/app/oracle/product/11.2.0/dbhome_1/dbs/archOldest online log sequence     1Next log sequence to archive   1Current log sequence           1[email protected]> [email protected]> create table t8(id number) tablespace users;——创建表并插入数据提交Table created.[email protected]> insert into t8 values(88);1 row created.[email protected]> commit;Commit complete.[email protected]> select * from t8;    ID----------    88[email protected]> alter tablespace users begin backup;——开始热备users表空间Tablespace altered.[[email protected] ~]$ cp users01.dbf /home/oracle/——备份用户表空间数据文件[email protected]> alter tablespace users end backup; ——结束备份users表空间Tablespace altered.

Close the database, delete the users data file, and then start the database

[email protected]> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.删除users数据文件[[email protected] PROD]$ rm -rf users01.dbf[email protected]> startupORACLE instance started.Total System Global Area  835104768 bytesFixed Size          2257840 bytesVariable Size         536874064 bytesDatabase Buffers      289406976 bytesRedo Buffers            6565888 bytesDatabase mounted.ORA-01157: cannot identify/lock data file 4 - see DBWR trace fileORA-01110: data file 4: ‘/u01/app/oracle/oradata/PROD/users01.dbf‘——报错,找不到数据文件

Copy the backed up users data file to the original directory of the database.

 mv/home/oracle/users01.dbf/u01/app/oracle/oradata/prod--Copy data file [email protected]> Select Open_mode from v$ Database;open_mode--------------------mounted[email protected]> ALTER DATABASE open;alter database open* ERROR at line 1:ora-01113:file 4 needs media recoveryora-01110:data file 4: '/U01/APP/ORACLE/ORADATA/PROD/USERS01.DBF '-- ------Query the users data file with an ID of 4-----------Select File_name,file_id,tablespace_name from Dba_data_files where tablespace_name = ' USERS '; file_name file_id tablespace_name--------------------------------------------------------------- ---------------------------/u01/app/oracle/oradata/prod/users01.dbf 4 users[email protected]> recover D Atafile 4;--Recovery Data File 4th, media recovery complete. [Email protected] od> ALTER DATABASE open;--Open the data file database altered. [email protected]> Select Open_mode from V$database;open_mode--------------------READ write[email     Protected]> SELECT * from T8;   ID---------- 88 

Oracle 11g Manual Hot Spare-tablespace

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.