In linux, to transmit data to a remote server after being backed up by rman, you can select ftp, scp, nfs, and other methods. You can configure ftp or shared implementation on the win host. there are already many solutions for linux. Here we will focus on providing solutions to achieve rman backup and transfer it to a remote server in win, and simply implementing the remote backup method:
1. In windows, configure the shared directory and set the remote server to have the write permission. If it is easy, you can configure everyone to have the read and write permissions.
2. Create the relevant backup directory. Here the main options are rmanfile, rmanscript, and rmanlog.
3. Compile the rman backup script
The code is as follows: |
Copy code |
Configure retention policy to redundancy = 7; Configure device type disk parallelism 4; Configure default device type to disk; Backup as compressed backupset database format 'E: \ backup_db \ rmanfile \ full _ % T _ % U. rman '; SQL 'alter system archive log current '; Backup as compressed backupset archivelog all format 'E: \ backup_db \ rmanfile \ arch _ % T _ % U. rman 'delete input; DELETE noprompt OBSOLETE; Crosscheck backup; Delete noprompt expired backup; Backup format 'E: \ backup_db \ rmanfile \ ctl _ % T _ % U. rman 'current controlfile; Backup spfile format 'E: \ backup_db \ rmanfile \ spfile _ % T _ % U. rman '; Exit; |
4. Call the rman backup script
The code is as follows: |
Copy code |
Rman target/destination file = E: \ backup_db \ scriptfile \ backup_db.rman Log = E: \ backup_db \ logfile \ rmanlog _ % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2%. log |
5. Copy to remote script
It should be noted that the date in the backup set is deleted as a mark, that is, it is best not to perform a backup across days.
The code is as follows: |
Copy code |
Copy/y e: \ backup_db \ rmanfile \ * _ % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2% _ *. RMAN \ 192.168.13.40 \ oracle_backup
|
6. Delete the backup script of the remote server N days ago.
It should be noted that the date in the backup set is deleted as a mark, that is, it is best not to perform a backup across days.
The code is as follows: |
Copy code |
@ Echo off Set DaysAgo = 5 Call: DateToDays % date :~ 0, 4% % date :~ 5, 2% % date :~ 8, 2% PassDays Set/a PassDays-= % DaysAgo % Call: DaysToDate % PassDays % DstYear DstMonth DstDay Del \ 192.168.13.40 \ oracle_backup \ * _ % DstYear % DstMonth % DstDay % _ *. RMAN Goto: eof : DateToDays % yy % mm % dd % days Setlocal ENABLEEXTENSIONS Set yy = % 1 & set mm = % 2 & set dd = % 3 If 1% yy % LSS 200 if 1% yy % LSS 170 (set yy = 20% yy %) else (set yy = 19% yy %) Set/a dd = 100% dd % 100, mm = 100% mm % 100 Set/a z = 14-mm, z/= 12, y = yy + 4800-z, m = mm + 12 * Z-3, j = 153 * m + 2 Set/a j = j/5 + dd + y * 365 + y/4-y/100 + y/400-2472633 Endlocal & set % 4 = % j % & goto: EOF : DaysToDate % days % yy mm dd Setlocal ENABLEEXTENSIONS Set/a = % 1 + 2472632, B = 4 * a + 3, B/= 146097, c =-B * 146097, c/= 4, c + = Set/a d = 4 * c + 3, d/= 1461, e =-1461 * d, e/= 4, e + = c, m = 5 * e + 2, m/= 153, dd = 153 * m + 2, dd/= 5 Set/a dd =-dd + e + 1, mm =-m/10, mm * = 12, mm + = m + 3, yy = B * 100 + d-4800 + m/10 (If % mm % LSS 10 set mm = 0% mm %) & (if % dd % LSS 10 set dd = 0% dd %) Endlocal & set % 2 = % yy % & set % 3 = % mm % & set % 4 = % dd % & goto: EOF |
7. Configure scheduled tasks to run related scripts on a scheduled basis
Scheduled Tasks on windows Server must be created. Otherwise, they cannot be executed. We recommend that you create a scheduled execution task plan on Windows Server 2008)