Backup and restore the database up to the dream

Backup and restore the database up to the dream

Up to the dream of the database backup and restore methods: physical backup restore and logical backup restore
physical backup:
Cold Standby: (lower dmap service opened, the database is closed)
Hot Standby: (dmap services must be opened, the database is open, to open the archive database)
physical backup and restore the operating system to the physical file database (such as data files, log files and control files, etc.) of backup.

Logical backup:
Export: Dexp
Import: DIMP
logical derivation logic and database objects introduced into four levels: the database level, a user level, mode and table level. Four levels independent mutually exclusive, can not exist simultaneously. Four levels of functionality provided by:
l the database level (FULL): export or import all objects in the entire database.
 user level (OWNER): export or import one or more of all objects owned by the user.
 mode stage (SCHEMAS): export or import all objects or a plurality of modes.
 level table (TABLE): export or import one or more partitions designated table or tables.

1, archiving database open
mount state
alter database mount;

Set archive path
alter database add archivelog 'type = local , dest = D: \ dmdbms \ bakup, file_size = 64, space_limit = 0';

Open archive
alter database archivelog;

open state
alter database open;

Check the state of the database
select name, status $, ARCH_MODE from v $ database;
Backup and restore the database up to the dream

2, start the backup operation
backup command backup
operation is performed this time a full backup. dmap to open, shut down the database instance.

Re-open a command window, next visit DM installation path with the operating system command bin directory and execute dmap in / dm7 / bin directory, open an account dmap.
Backup and restore the database up to the dream

And then re-enter the SQL window to perform backup database backupset 'D: \ dmdbms \ bakdb \ db';
Backup and restore the database up to the dream
Backup and restore the database up to the dream

dexp backup command
dexp DIMP table can be prepared, user mode, the database
using export tool DM:
Backup and restore the database up to the dream
Backup and restore the database up to the dream

Export command:
Dexp the TEST1 / TEST123456 File = D: \ dmdbms \ bakdb \ 20,191,128 \ db_bak.dmp

D:\dmdbms\bin>dexp TEST1/TEST123456 file=D:\dmdbms\bakdb\20191128\db_bak.dmp
dexp V7.6.0.77-Build(2018.07.17-94714)ENT

Exporting 1st SCHEMA: TEST1

Start Export mode [TEST1] .....

----- Total export 0 SEQUENCE -----

----- Total export 0 VIEW -----

----- Total export 0 TRIGGER -----

----- Total export 0 COMMENT TAB -----

----- Total export 0 COMMENT COL -----

----- Total export 0 PROCEDURE -----

----- Total export 0 SYNONYM -----

----- Total export 0 DBLINK -----

----- Total export 0 TRIGGER -----

----- 共导出 0 个PACKAGE -----

----- 共导出 0 个PKG_BODY -----

----- 共导出 0 个OBJECT of NO REFER OTHER CLASS -----

----- 共导出 0 个OBJECT of REFER OTHER CLASS -----

----- 共导出 0 个JCLASS -----

----- 共导出 0 个CLASS_BODY -----

----- 共导出 0 个DOMAIN -----

导出模式下的对象权限...

----- [2019-11-28 15:42:35]导出表:STUDY -----

导入/出 STUDY 注释

导入/出 STUDY 注释

导入/出 STUDY 注释

导入/出 STUDY 注释

导入/出 STUDY 注释

导入/出 STUDY 注释

导入/出 STUDY 注释

导出模式下的对象权限...

表STUDY导出结束,共导出 3 行数据

----- [2019-11-28 15:42:36]导出表:COURSE -----

导入/出 COURSE 注释

导入/出 COURSE 注释

导入/出 COURSE 注释

导入/出 COURSE 注释

导出约束:CONS134218824

导出模式下的对象权限...

表COURSE导出结束,共导出 3 行数据

----- [2019-11-28 15:42:36]导出表:TAB1 -----

导出模式下的对象权限...

表TAB1导出结束,共导出 2 行数据

模式[TEST1]导出结束.....

成功导出 第1 个SCHEMA :TEST1

共导出 1 个SCHEMA

整个导出过程共花费 0.266 s

成功终止导出, 没有出现警告

D:\dmdbms\bin>

3、开始还原操作

创建新用户TEST2,并给用户赋管理员权限
create user TEST2 identified by TEST123456 default tablespace tbs1;
grant dba to TEST2;
Backup and restore the database up to the dream

新用户创建好了,我们开始执行导入操作,TEST1导入到TEST2
利用DM工具导入:
Backup and restore the database up to the dream

命令导入:
 dimp TEST1/TEST123456 file=D:\dmdbms\bakdb\20191128\db_bak.dmp ignore=y remap_schema=TEST1:TEST2
D:\dmdbms\bin>dimp TEST1/TEST123456 file=D:\dmdbms\bakdb\20191128\db_bak.dmp ignore=y remap_schema=TEST1:TEST2
dimp V7.6.0.77-Build(2018.07.17-94714)ENT

Start import mode [the TEST1] ......

NECESSARY GLOBAL imported objects mode ......

NECESSARY GLOBAL object model in the completion of introduction ......

----- [2019-11-28 16:43:01] Import table: STUDY -----

Create a table STUDY ...

STUDY data into a table in: 3 rows to be processed

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

Import / annotations out STUDY

STUDY

The import was successful ......

----- [2019-11-28 16:43:01] Import table: COURSE -----

Create a table COURSE ...

COURSE data into a table in: 3 rows to be processed

Import / annotations out COURSE

COURSE

The import was successful ......

Import / annotations out COURSE

COURSE

The import was successful ......

Import / annotations out COURSE

COURSE

The import was successful ......

Import / annotations out COURSE

COURSE

The import was successful ......

----- [2019-11-28 16:43:01] Import table: TAB1 -----

Create table TAB1 ...

The data into a table TAB1: 2 rows to be processed

GLOBAL imported objects mode ......

GLOBAL object model in the completion of introduction ......

Mode [the TEST2] Import complete ......

Introducing the constraint table:

CONS134218824

The import was successful ......

The import was successful ......

Introducing whole process takes a total of 0.153 s

Import terminated successfully without warnings

D:\dmdbms\bin>

Guess you like

Origin blog.51cto.com/14615334/2454563