From 9adefb3d2da3849ba3b716b469f1740fef395d2e Mon Sep 17 00:00:00 2001 From: iProbe Date: Sun, 29 Jan 2023 14:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20'=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93/oracle/=E5=BD=92=E6=A1=A3=E6=97=A5=E5=BF=97=E5=8F=8A?= =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=A4=84=E7=90=86.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 数据库/oracle/归档日志及备份处理.md | 78 +++++++++++++---------------- 1 file changed, 35 insertions(+), 43 deletions(-) diff --git a/数据库/oracle/归档日志及备份处理.md b/数据库/oracle/归档日志及备份处理.md index 6a39061..de72588 100644 --- a/数据库/oracle/归档日志及备份处理.md +++ b/数据库/oracle/归档日志及备份处理.md @@ -1,3 +1,4 @@ +# 归档 ## 关闭归档 ```sql archive log list; #查看是否是归档方式 @@ -70,38 +71,33 @@ select sum(percent_space_used)*3/100 from v$flash_recovery_area_usage; ```sql ALTER SYSTEM SET DB_RECOVERY_FILE_DEST_SIZE=8g; ``` - -## rman清理日志 +## rman登录 ```sql rman target / ``` ## 删除过期归档日志 ```sql +# 检查日志 crosscheck archivelog all; +# 删除提示 delete expired archivelog all; +# 无删除提示 +delete noprompt expired archivelog all; +``` +## 刪除所有的Archivelog files +```sql +delete archivelog all;  ``` ## 删除昨天以前的归档日志 ```sql +# 无删除提示 delete noprompt archivelog until time 'sysdate-1'; -``` - -# 其他 -## 显示rman配置 -```sql -show all; -``` -## 报告目标数据库的物理结构 -```sql -report schema; -``` -## 报告陈旧备份 -```sql -report obsolete; -``` -## 报告不可恢复的数据文件 -```sql -report unrecoverable; -``` +# 强制删除昨天之前的日志 +delete force archivelog until time 'sysdate-1'; +# 无提示强制删除昨天之前的日志 +delete noprompt force archivelog until time 'sysdate -1'; +`` +# 备份 ## 列出备份信息 ```sql list backup; @@ -121,24 +117,6 @@ crosscheck backup of controlfile; crosscheck backup of spfile; crosscheck backup of archivelog all; ``` -## 校验没有备份过的归档日志 -```sql -crosscheck archivelog all; -delete noprompt expired archivelog all; -``` -## 刪除所有的Archivelog files -```sql -delete archivelog all;  -``` -## 強制刪除昨天以前的archivelog files -```sql -delete force archivelog until time 'sysdate -1'; -delete noprompt force archivelog until time 'sysdate -2'; -``` -## 刪除所有过期的Archivelog files -```sql -delete expired archivelog all; -``` ## 删除陈旧备份 ```sql delete obsolete; @@ -167,6 +145,24 @@ change backupset id nokeep; ```sql configure retention policy to recovery window of 30 days; ``` + +# 其他 +## 显示rman配置 +```sql +show all; +``` +## 报告目标数据库的物理结构 +```sql +report schema; +``` +## 报告陈旧备份 +```sql +report obsolete; +``` +## 报告不可恢复的数据文件 +```sql +report unrecoverable; +``` ## 改为基于冗余数量的备份 ```sql configure retention policy to redundancy n ; @@ -175,7 +171,3 @@ configure retention policy to redundancy n ; ```sql configure retention policy to none; ``` -## 设置归档日志存放在其它位置 -```sql -set archivelog destination to 'e: emp'; -``` \ No newline at end of file