Oracle Backup, restore

Source: Internet
Author: User

---- First step: Set up empty table export

----The empty table cannot be exported because Oracle 11G is exported with export. The workaround is as follows: (There is a new feature in 11G that does not allocate segment to save space when the table has no data)

Select ' ALTER TABLE ' | | table_name| | ' Allocate extent (size 64k); ' From tabs t
Where NOT EXISTS (select Segment_name from user_segments s where s.segment_name=t.table_name);

--Execute the above statement in Plsql and copy the query result set, execute the copied statement data

2, the first installation of the Oracle database, with SYSDBA login Plsql execute the following statement, then the table space and user-created:

Set the parameter for creating segment to False, and an empty table can import and export at any later time.

alter system set DEFERRED_SEGMENT_CREATION=FALSE;

---Note: After you modify this setting, the tablespace that creates the library can implement any import and export of empty tables, but before you modify the settings database, you must perform the first step of exporting the empty table settings statement.

--- Step two: Back up the database

---Start-run, enter CMD, enter BACKUP statement

Exp userid=abc/[email protected] file=d:\01abc\ database backup \abc20160520.dmp log=d:\01abc\ database backup \abc20160520.log

---Description: Exp userid= username/password @net service name file= (Backup database file path) \ backup file name. DMP log= (log path) \ log path.

--- Step three: Restore the database

---Start-run, enter CMD, enter a RESTORE statement

Imp userid=abc/[email protected] file=d:\01abc\ database backup \abc20160520.dmp full=y log=d:\01abc\ database backup \ Abc20160907.log

---Description: Imp userid= username/password @net service name file= (Backup database file path) \ backup file name. DMP full=y log= (log path) \ log path. Log, note and backup statements differ in that the ① command is the Imp ② added Full=y.

-- other

1, if it is to back up a table or a few tables, you can use the "tool-Export table" in Plsql, select one or more tables to complete, but this way can not back up the view, etc., the whole library backup needs to be backed up by the statement.

2. The password of the Oracle user must be changed within 180 days, otherwise the connection failure will be prompted when starting the database. Prevent Oracle user passwords from expiring:

ALTER profile DEFAULT LIMIT password_life_time UNLIMITED;

Oracle Backup, restore

Related Article

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.