当前位置:网站首页>Oracle deleting archived logs and adding scheduled tasks
Oracle deleting archived logs and adding scheduled tasks
2022-06-28 22:27:00 【1024 Q】
One 、 Delete archive log
1. Switching users
2. Use RMAN Tools
3. Connect to local database
4. Check the difference between the control file and the actual physical file
5. Check the information of the control file and the actual physical file synchronously
6. Delete n Archive logs from days ago
7. sign out RMAN
Two 、 Add timing task
1. Create archive log delete script
2. Grant script file execution permission
3. Test the archive log deletion script
4. Add timing task
5. View scheduled tasks
summary
One 、 Delete archive log 1. Switching users# Switch to oracle user su – oracle2. Use RMAN Tools # Use RMAN Tools , Delete invalid archive logs rmannotes :RMAN(Recovery Manager) Is a method for backup (backup)、 Restore (restore) And recovery (recover) Database Oracle Tools .
3. Connect to local database# Use target Command to connect to the local database RMAN> connect target /4. Check the difference between the control file and the actual physical file perform crosscheck command , Check the difference between the control file and the actual physical file , If the physical file does not exist on the media , Mark as expired( invalid / Unavailable ),crosscheck after , You can delete these invalid archive logs ( After executing the script , The deleted archive log status will change to “ invalid ”)
RMAN> crosscheck archivelog all;5. Check the information of the control file and the actual physical file synchronously # Delete status is expired( invalid / Unavailable ) The archive log of RMAN> delete expired archivelog all;6. Delete n Archive logs from days ago # Delete 3 Archive logs from days ago :RMAN> delete archivelog all completed before 'sysdate-3';# Delete 1 Days ago, RMAN> delete archivelog until time 'sysdate-1'difference : The first strip complete The sentence of , The main task is to delete the archive that has been backed up , Archive without backup , It won't be deleted . And the second statement , The archive will be deleted , Whether backed up or not .
7. sign out RMAN# sign out RMANRMAN> exit Two 、 Add timing task 1. Create archive log delete script archivelog_clear.sh
#!/bin/bashBACK_DIR=/home/oracle/clear_archlog/dataexport DATE=`date +%F`mkdir -p $BACK_DIR/$DATEtouch $BACK_DIR/$DATE/rman_backup.logecho "--------------------------------`date`-------------------------------"source ~/.bash_profile # Log rman_backup.log You can check whether the execution is successful later rman target / >> $BACK_DIR/$DATE/rman_backup.log <<EOF # Put the invalid expired Of archivelog Mark it out crosscheck archivelog all;# Delete all expired archive logs directly #delete noprompt expired archivelog all;# Delete directly 7 All archived logs days ago delete noprompt archivelog all completed before 'sysdate-7';exitEOFecho -e "\n"echo "------------------------------ FINISHED ----------------------------"2. Grant script file execution permission # Grant Execution Authority chmod +x archivelog_clear.sh3. Test the archive log deletion script ./archivelog_clear.sh4. Add timing task Enter the command :crontab -e Edit and add a new line of tasks
30 3 15 * * /home/oracle/archivelog_clear.sh5. View scheduled tasks crontab -l summary This is about Oracle That's all for the articles on deleting archived logs and adding scheduled tasks , More about Oracle To delete the contents of the archive log, please search the previous articles of the software development network or continue to browse the relevant articles below. I hope you will support the software development network in the future !
边栏推荐
- Ctrip will push the "3+2" working mode: 3 days a week on duty and 2 days of free choice of office space. Do you envy it?
- The love digital smart 2022 summit opens, sharing data strategy and building data-driven organization methodology
- 犹豫的根音
- 6年心得,从功能测试到测试开发,送给在测试路上一路走到黑的你
- 基于graph-linked embedding的多组学单细胞数据整合与调控推理
- 项目管理到底管的是什么?
- Pat 1054 the dominiant color (20 points)
- Detailed explanation of Zadig's self-test and joint debugging sub environment for developers
- go语言插件平台的实现思路
- 【HackTheBox】 meow
猜你喜欢

如何制作精美的图片

Detailed explanation of Zadig's self-test and joint debugging sub environment for developers

Post-00 cloud native Engineer: use Zadig to increase revenue and reduce expenditure for the R & D of Sichuang Technology (Guangzhou public transport)

稳!上千微服务如何快速接入 Zadig(Helm Chart 篇)

这个简单的小功能,半年为我们产研团队省下213个小时

Zadig officially launched vs code plug-in, making local development more efficient

Summary of time series prediction series (code usage)

Linux安装mysql5.7(CentOS7.6) 教程

Considerations on the construction of operation and maintenance system - stability

Pytorch builds transformer to realize multivariable and multi step time series forecasting (load forecasting)
随机推荐
10、标准I/O输入输出重定向及管道
Move the mouse out of the selected area style cancel
Post-00 cloud native Engineer: use Zadig to increase revenue and reduce expenditure for the R & D of Sichuang Technology (Guangzhou public transport)
Can we still enter the "pit" data analysis now? Look at the hot jobs of data analysis in 2022!
Pytorch builds transformer to realize multivariable and multi step time series forecasting (load forecasting)
C#/VB.NET 将PDF转为Excel
Research Report on workers: middle-aged people account for the highest proportion of naked words
常用工具类与commons 类库
YAYA LIVE CTO 唐鸿斌:真正本地化,要让产品没有「产地」属性
项目管理到底管的是什么?
阿海的忠告
穿越过后,她说多元宇宙真的存在
职业问诊 | 在数据分析面试中,这样做自我介绍才靠谱
职场进阶 | 了解岗位优势三板斧之“进场”
场景化接口开发利器,金蝶云苍穹新版OpenAPI引擎来了!
【Try to Hack】nmap
Use of axurer9 option group
Detailed explanation of Zadig's self-test and joint debugging sub environment for developers
6年心得,从功能测试到测试开发,送给在测试路上一路走到黑的你
Akamai acquires linode