当前位置:网站首页>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 !
边栏推荐
- 职场进阶 | 了解岗位优势三板斧之“进场”
- Axure custom components
- Rule engine development experience sharing - reddit
- Introduction to wrk pressure test tool
- TCP three handshakes and four waves
- 科技巨头成立元宇宙标准论坛,走向开放还是建立围城?
- Interpretation of papers (DCN) towards k-means-friendly spaces: simultaneous deep learning and clustering
- Gross vs60 billion. Is food safety the biggest obstacle to Weilong's listing?
- Zadig 面向開發者的自測聯調子環境技術方案詳解
- 5毛VS600亿,食品安全问题是卫龙上市最大的拦路虎?
猜你喜欢

2022-06-28:以下golang代码输出什么?A:true;B:false;C:panic;D:编译失败。 package main import “fmt“ func main() {

共探数字技术与信息安全,第四届中俄数字论坛成功举办

Considerations on the construction of operation and maintenance system - stability

Zadig + 洞态 IAST:让安全溶于持续交付

The love digital smart 2022 summit opens, sharing data strategy and building data-driven organization methodology

10、标准I/O输入输出重定向及管道
oracle设置密码复杂度及设置超时退出的功能

5毛VS600亿,食品安全问题是卫龙上市最大的拦路虎?

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

The new version of OpenAPI engine of Kingdee cloud dome is coming!
随机推荐
With the development of industrial Internet as the starting point, the industry can enter a new stage of development
Use of axurer9 master
How powerful is the Zadig build? Practice together
Hyperjumptech/grule-rule-engine: rule engine implementation of golang
5毛VS600亿,食品安全问题是卫龙上市最大的拦路虎?
犹豫的根音
题解 洛谷P1762 偶数/6.21校内考试T2
Can we still enter the "pit" data analysis now? Look at the hot jobs of data analysis in 2022!
数据可视化中柱状图的实例应用,让乘风破浪公演结果一目了然
论文解读(DCN)《Towards K-means-friendly Spaces: Simultaneous Deep Learning and Clustering》
MSCI 2022年市场分类评估
What is the prospect of VR panoramic production?
Yiming Anke submitted a statement to the Hong Kong Stock Exchange: the loss doubled in 2021, and the past financing amount was exaggerated
Quartz定时任务触发器启动时设置
Water brother's code
共探数字技术与信息安全,第四届中俄数字论坛成功举办
torch.nn.Transformer导入失败
apipost脚本使用讲解一~全局变量
YAYA LIVE CTO 唐鸿斌:真正本地化,要让产品没有「产地」属性
职业问诊 | 面试中被问到意向薪资时,该怎么回答?