Oracle database backup --- export and import

The cmd command backup windows using export data (can also be connected to operate the sqlplus)
- Export
- completely derived database ORCL
exp System / ORCL Oracle @ File = C: \ oracle_bak \ orcl_bak.dmp Full = Y

- database All objects in the scott user to export
exp scott / tiger1 @ orcl file = c: \ oracle_bak \ scott_bak.dmp owner = scott

- the scott user table emp, dept export
exp scott / tiger1 @ orcl file = c: \ oracle_bak \ table_bak.dmp tables = (emp, dept)

- Import
- Import backup files to the database
imp scott / tiger1 @ orcl file = c: \ oracle_bak \ scott_bak.dmp ignore = y

- the scott user's backup files into yanln users
imp yanln / yanln @ orcl fromuser = scott touser = yanln file = c: \ oracle_bak \ scott_bak.dmp

- Create a backup table staff table of
the CREATE TABLE emp_bak
AS
the SELECT * the FROM emp;

- Create triggers to synchronize backup data
- when employees deleted, backup table synchronization delete
the CREATE OR REPLACE TRIGGER syno_bak_trigger
an AFTER DELETE
ON emp
the FOR EACH ROW
BEGIN
DELETE the FROM emp_bak the WHERE empno =: old.empno;
END;

- Testing
SELECT * FROM EMP;

DELETE FROM emp WHERE empno = 7499;

select * from emp_bak;

rollback;


May also be utilized in addition PL / SQL Developer tool export and import

Guess you like

Origin www.cnblogs.com/xiaomifeng1010/p/11141400.html