set lines 200 set pages 0 set trimspool on set heading off set echo off set feedback off set verify off spool cp_files.sh SELECT 'cp ' || a.file_name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.file_name, ( INSTR (b.file_name, '/', -1, 1) + 1))) FROM cdb_data_files b WHERE a.file_name = b.file_name) FROM cdb_data_files a UNION SELECT 'cp ' || a.MEMBER || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.MEMBER, ( INSTR (b.MEMBER, '/', -1, 1) + 1))) FROM v$logfile b WHERE a.MEMBER = b.MEMBER) FROM v$logfile A UNION SELECT 'cp ' || a.name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.name, ( INSTR (b.name, '/', -1, 1) + 1))) FROM v$tempfile b WHERE a.name = b.name) FROM v$tempfile a UNION SELECT 'cp ' || a.name || ' /u01/oracle/cold_backup/' || (SELECT TRIM (SUBSTR (b.name, ( INSTR (b.name, '/', -1, 1) + 1))) FROM v$controlfile b WHERE a.name = b.name) FROM v$controlfile a;
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
Friday, December 8, 2023
How to generate a cold backup script for a database
Probably many ways to to this, but here is how I generated a simple file that after being made executable will copy all files to a specific folder.
The database must be shut down before running the script, so in other words, this will be a good, old-fashioned cold backup!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment