1. 登录
disql sysdba/sysdba
00001.
SQL>select arch_mode from v$database;
00002.
00003.
LINEID ARCH_MODE
00004.
00005.
---------- ---------
00006.
00007.
1 N
00008.
3. 设置归档模式
1) 编辑dm.ini
默认路径: /opt/dmdbms/data/DAMENG/dm.ini
编辑该文件,设置: "ARCH_INI = 1"
2) 设置归档目录
mkdir /opt/dmdbms/data/DAMENG/arch
3) 配置dmarch.ini (/opt/dmdbms/data/DAMENG/dmarch.ini)
00001.
[ARCHIVE_LOCAL1]
00002.
00003.
ARCH_TYPE = LOCAL
00004.
00005.
ARCH_DEST = /opt/dmdbms/data/DAMENG/arch
00006.
00007.
ARCH_FILE_SIZE = 128 #归档文件大小限制Mb为单位,缺省128M
00008.
00009.
ARCH_SPACE_LIMIT = 0 #空间限制MB为单位,范围1024 ~ 4294967294,默认0表示无空间限制
00010.
4) 重启数据库生效
dmserver path=/opt/dmdbms/data/DAMENG/dm.ini
或
/etc/init.d/DmServiceDMSERVER restart
重新查询,已生效
00001.
SQL>select arch_mode from v$database;
00002.
00003.
00004.
00005.
LINEID ARCH_MODE
00006.
00007.
---------- ---------
00008.
00009.
1 Y
00010.
4. create tablespace,user and test tables
1) query tablespace
SQL>SELECT ts.NAME, df.PATH FROM V$TABLESPACE AS ts, V$DATAFILE AS df WHERE ts.ID = df.GROUP_ID;
2) create tablespace
SQL>create tablespace duanbb DATAFILE '/opt/dmdbms/data/DAMENG/DUANBB.DBF' SIZE 128;
3) create user
00001.
SQL>create user duanbb identified by duanbb default tablespace "DUANBB";
00002.
00003.
SQL>grant resource to DUANBB;
00004.
4) create tables
00001.
SQL>conn DUANBB/DUANBB
00002.
00003.
SQL>create table t1(ID NUMBER(10), NAME VARCHAR(30));
00004.
5. backup/restore
1) database full backup/restore
a) online backup
SQL>BACKUP DATABASE FULL TO full_bak BAKFILE '/test/duanbb/DM/backup/full.bak';
b) restore: 对于数据库级的还原只支持脱机还原,不提供联机还原的功能
/etc/init.d/DmServiceDMSERVER stop
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/full.bak
/etc/init.d/DmServiceDMSERVER start
2) database increment backup/restore
a) online backup
SQL>BACKUP DATABASE INCREMENT WITH BACKUPDIR '/test/duanbb/DM/backup/' TO inc1 BAKFILE '/test/duanbb/DM/backup/inc1.bak';
b) restore to backup
00001.
/etc/init.d/DmServiceDMSERVER stop
00002.
00003.
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/inc1.bak
00004.
00005.
/etc/init.d/DmServiceDMSERVER start
00006.
3) restore to assigned time point
/etc/init.d/DmServiceDMSERVER stop
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/full_0816.bak TIME="2013-8-16 13:38:50" ARCHIVE_DIR=/opt/dmdbms/data/DAMENG/arch
/etc/init.d/DmServiceDMSERVER start
4) tablespace backup/restore
a) full backup/restore
backup:
SQL>BACKUP TABLESPACE duanbb FULL TO duanbb_full_bak BAKFILE '/test/duanbb/DM/backup/ts_duanbb_full.bak';
restore:
00001.
SQL>ALTER TABLESPACE duanbb OFFLINE;
00002.
00003.
SQL>RESTORE TABLESPACE duanbb FROM '/test/duanbb/DM/backup/ts_duanbb_full.bak';
00004.
00005.
SQL>ALTER TABLESPACE duanbb ONLINE;
00006.
b) increment backup/restore:
backup:
SQL>BACKUP TABLESPACE duanbb INCREMENT WITH BACKUPDIR '/test/duanbb/DM/backup' TO duanbb_inc1 BAKFILE '/test/duanbb/DM/backup/ts_duanbb_inc1.bak';
restore:
00001.
SQL>ALTER TABLESPACE duanbb OFFLINE;
00002.
00003.
SQL>RESTORE TABLESPACE duanbb FROM '/test/duanbb/DM/backup/ts_duanbb_inc1.bak';
00004.
00005.
SQL>ALTER TABLESPACE duanbb ONLINE;
00006.
5) parallel backup
user 'DUANBB', tablespace: 'DUANBB'
user 'DSG', tablespace: 'DSG'
a) create parallel backup configure file '/test/duanbb/DM/bak.parallel' as followed contents
[DUANBB]=/test/duanbb/DM/backup/duanbb
[DSG]=/test/duanbb/DM/backup/dsg
[default]=/test/duanbb/DM/backup
b) backup
full backup
SQL>BACKUP DATABASE FULL TO PARA_BAK_1 BAKFILE '/test/duanbb/DM/backup/parallel1.bak' PARALLEL '/test/duanbb/DM/bak.parallel';
increment backup
SQL>BACKUP DATABASE INCREMENT WITH BACKUPDIR '/test/duanbb/DM/backup/' TO para_inc1 BAKFILE '/test/duanbb/DM/backup/para_inc1.bak';
c) restore
/etc/init.d/DmServiceDMSERVER stop
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/parallel1.bak
or
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/parallel1.bak TIME="2013-8-19 11:28:00" ARCHIVE_DIR=/opt/dmdbms/data/DAMENG/arch
or
./bin/dmrestore INI_PATH=/opt/dmdbms/data/DAMENG/dm.ini FILE=/test/duanbb/DM/backup/parallel1.bak ARCHIVE_DIR=/opt/dmdbms/data/DAMENG/arch
/etc/init.d/DmServiceDMSERVER start