IMP / EXP, data pump, SQL * Loader, rman, oracle database backup

IMP / EXP, data pump, SQL * Loader, rman

Logical database backup and recovery: exp IMP and
1. guide library: the entire database export and import
2. Table I. Space: Export and Import table space
3. Table I. User: Export and import all objects in the user
4. Table I.: Export and introducing partition table or table

(1) commit = y Insert and commit frequently submitted will affect the efficiency of the database. You can add committing database is too large.
(2) ignore = y / n This parameter indicates ignore create errors and continue.
(3) full = y is fully introduced.

Table 1. Import Export
backup test table:
Create Tables emp_test AS SELECT * from emp_test;

exp export database table:
exp Scott / 123456 @ = ORCL File / Oracle / bak_oracle / emp_test.dmp Tables = "emp_test"
Conditional selective derived
exp scott/[email protected]: 1521 / orcl file = / oracle / bak_oracle /emp_test.dmp tables = "emp_test" query = \ "where sal between '1000' and '2000' \" log = / oracle / bak_oracle / emp_test.log
a user has permission to export different tables for different users
exp \ 'sys / syste as sysdba \ 'file = / oracle / bak_oracle / emp_test.dmp tables = "scott.emp_test, test.tab_test"

NOTE: oracle user login and configure TNSNAME direct scott / 123456
is not a native backup scott/[email protected]: 1521 / orcl

Delete the test table
drop table emp_test;
parameters purge

imp into database tables:
querying the user data stored default tablespace: select username, default_tablespace from dba_users where username = 'SCOTT';
in some special cases the user needs to put special data table space, use the following commands to modify.
Modify the user data stored default tablespace: ALTER TABLESPACE default User Scott XXX;
IMP Scott / 123456 = File / Oracle / bak_oracle / emp_test.dmp
a user has permission to export different tables for different users into a user table
IMP \ 'sys / system as sysdba \' file = / oracle / bak_oracle / emp_test.dmp fromuser = scott;

Queries table is deleted and the import was successful
select count (*) from emp_test;

2. Import Export user
to export a following user data
exp scott / 123456 file = / oracle / bak_oracle / scott.dmp owner = scott;
delete a user
the SQL> User drop Scott Cascade;
drop User Scott Cascade
*
ERROR AT Line. 1:
ORA -01.94 thousand: CAN A not drop the User that IS Rate this page Currently Connected
(1) to see if there are SQL statements in this table occupied
the SELECT sess.INST_ID, sess.machine,
sess.program, sess.sql_id,
sess.sid, sess.serial #,
sess.PROCESS
lo.oracle_username, lo.os_user_name,
lo.locked_mode,
ao.object_name, ao.object_type,
ao.status,
from GV $ locked_object LO, dba_objects AO, GV $ sess the session
the WHERE ao.object_id = lo.object_id
and LO = sess.sid .session_id
and sess.username = 'SCOTT'
- kill the process sid, Serial #
the ALTER System session'10,11562 the kill ';

(2) see if the session does not end
SQL> the SELECT username, sid, Serial #, PADDR, v $ Status from the session the WHERE username = 'SCOTT';
USERNAME SID SERIAL # PADDR the STATUS


SCOTT 1 281 000000008E51C510 KILLED
SCOTT 20 362 000000008E491150 INACTIVE
SCOTT 21 175 000000008E48D050 INACTIVE
SCOTT 28 169 000000008E51C510 KILLED

SQL> select PROGRAM from v$process where addr='000000008E490110';
PROGRAM
[email protected]

- kill the process sid, Serial #
the ALTER System the kill the session '1,281';
the ALTER System the kill the session '20, 362 ';
the ALTER System the kill the session '21, 175';
the ALTER System the kill the session '28, 169 ';
SQL> drop the User scott Cascade;
the User dropped Total .
Importing a user following data
prior authorization (connected to the database and DBA permissions) reintroduced (user SCOTT all of the following tables)
Grant connect, Resource to Scott IDENTIFIED by 123456;
Grant DBA to Scott;
IMP Scott / 123456 File = / Oracle /bak_oracle/scott.dmp full = y;

Introduced by the user to the user rights table has
imp 'sys/[email protected]: 1521 / orcl as sysdba' file = / oracle / bak_oracle / scott.dmp fromuser = scott touser = scott
NOTE: touser = give different users

3. Import Export table space

--- To be continued

Extension table space

The system will automatically expand the table space, table space if the system somehow large
1. Query audit function is open, audit data table in the large influence of
view the audit function is turned on
Show the Parameter Audit;
2. auditing shutdown command
SQL> alter system set = = FALSE scope SPFILE audit_sys_operations;
. the System Altered
the SQL> ALTER System SET = SPFILE scope AUDIT_TRAIL = NONE;
. the System Altered
restart the database into effect

Note: audit_sys_operations parameter settings:
none disable database auditing
os enabled database auditing and database audit records directed to the operating system audit records
db enable database auditing and database audit records directed to all database tables SYS.AUD $
xml enabled database audit and writes all records operating system files in XML format.
xml, extended to enable all columns in the database audit, the audit record output, including the value of SqlText and SqlBind.

3. Are there too many query statistics
statistics default time of 31 days, the time can be changed to 10 days or a week, outdated statistical information system automatically deleted
SQL> dbms_stats.get_stats_history_retention from the SELECT Dual;
SQL> conn / AS sysdba
. Connected
SQL > exec dbms_stats.alter_stats_history_retention (10);

Guess you like

Origin blog.51cto.com/7794482/2438335