root> su - oracle
oracle> export ORACLE_SID=venu
oracle> sqlplus / as sysdba
SQL> startup
oracle logical> rm *
oracle logical> export ORACLE_SID=venu
oracle logical> exp file=sunday.dmp log=sunday.log inctype=complete direct=y statistics=none buffer=200000
username : / as sysdba
direct=y - bypass the SGA layer
inctype=complete - full database backup with timestamp
buffer=200000 - the number of database buffer cache(DBC) buffers to use
SQL> conn scott/tiger
SQL> alter user scott account unlock identified by tiger;
scott> select * from tab;
scott> insert into emp select * from emp;
error : unique constraint violated
scott> alter table emp disable primary key cascade;
scott> insert into emp select * from emp;
scott> commit;
scott> select count(*) from emp;
oracle logical> exp file=monday.dmp log=monday.log inctype=incremental direct=y statistics=none buffer=200000
username : / as sysdba
Here only the emp table is backuped as the data is changed in it.
If any problem occurs, drop the scott schema and recreate the schema again.
SQL> conn scott/tiger
scott> alter table dept disable primary key cascade;
scott> insert into dept select * from dept;
scott> insert into salgrade select * from salgrade;
scott> commit;
scott> select count(*) from dept;
scott> select count(*) from salgrade;
oracle logical> exp file=tuesday.dmp log=tuesday.log inctype=incremental direct=y statistics=none buffer=200000
username : / as sysdba
Here emp,dept and salgrade table will be backuped as there is a relation between emp and dept.
scott> insert into salgrade select * from salgrade;
scott> commit;
scott> select count(*) from salgrade;
oracle logical> exp file=wedday.dmp log=wedday.log inctype=cumulative direct=y statistics=none buffer=200000
username : / as sysdba
Here emp,dept and salgrade tables will bebackuped.
scott> insert into emp select * from emp;
scott> commit;
scott> select count(*) from emp;
oracle logical> exp file=thursday.dmp log=thursday.log inctype=incremental direct=y statistics=none buffer=200000
username : / as sysdba
Here only emp table will be backuped.
scott> conn / as sysdba
SQL> select * from dba_exp_version;
SQL> select * from dba_exp_files;
SQL> select * from dba_exp_objects;
No comments:
Post a Comment