备份方法:
物理备份 (数据文件)
冷备份(数据库关闭)
1.数据库关闭
[dmdba@dm1 DAMENG]$ /etc/rc.d/init.d/DmServiceTEST status
[dmdba@dm1 DAMENG]$ /etc/rc.d/init.d/DmServiceTEST stop
2.开启damp服务要开启
[dmdba@dm1 DAMENG]$/etc/rc.d/init.d/DmAPService status
3.执行备份
[dmdba@dm1 bin]$ cd /dm7/bin
[dmdba@dm1 bin]$ ./dmrman
RMAN> backup database '/dm7/data/DAMENG/dm.ini' backupset '/dm7/backup/backups'
[dmdba@dm1 backups]$ ls
backups.bak(备份文件) backups .meta(备份的元数据)
4.备份还原
RMAN> recover database '/dm7/data/DAMENG/dm.ini' from backupset '/dm7/backup/backups'
热备份(数据库打开)
打开归档
SQL> alter database mount;
-
配置归档文件
SQL> alter database add archivelog 'type=local,dest=/dm7/arch,file_size=64,space_limit=0';
-
打开归档
SQL> alter database archivelog;
-
打开数据库
SQL> alter database open;
数据库打开
[dmdba@dm1 DAMENG]$ /etc/rc.d/init.d/DmServiceTEST status
dmap服务启动
[dmdba@dm1 DAMENG]$ /etc/rc.d/init.d/DmAPService status
备份:(库,表空间,表,归档)
SQL> backup database backupset '/dm7/backup/db_bak';
SQL> backup tablespace dmhr backupset '/dm7/backup/dmhr_bak';
SQL> backup table dmhr.employee backupset '/dm7/backup/emp_bak';
SQL> backup archivelog backupset '/dm7/backup/arch_bak';
逻辑备份(SQL)
备份参数查询:
[dmdba@dm1 db_bak]$ dexp help
备份表:
[dmdba@dm1 db_bak]$ dexp sysdba/SYSDBA file=/dm7/backup/emp.dmp tables=dmhr.emp
还原表:
[dmdba@dm1 db_bak]$ dimp sysdba/SYSDBA file=/dm7/backup/emp.dmp tables=dmhr.emp