Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Backing up SYSAUX tablespace with user managed backups in 12.2.x.

GlenStromOct 15 2019 — edited Oct 16 2019

After first database upgrade to 12.2,  something I just discovered in user managed backups of 12.2.x databases

Since SYSTEM user cannot put SYSAUX tablespace in backup mode in 12.2.x, the user managed backup has to be done as user SYS, or create procedure(s) to put SYSAUX tablespace in and out of backup mode, grant execute to SYSTEM and run the procedures before and after copying the SYSAUX datafile to backup destination.

If database has a lot of tablespaces and is quite busy, my preference is to put tablespaces in backup mode one at a time rather than entire database, also assuming "alter database begin backup" as system user then copying all datafiles will not copy SYSAUX datafiles correctly.  

A client has one (busy) database with a few dozen tablespaces that has a user managed backup running nightly as well as RMAN incremental backups. The script to generate the SQL for the user managed backup no longer worked as is, so I created a procedure owned by SYS that can be executed by SYSTEM that puts the SYSAUX tablespace in backup mode, and another to take it out of backup mode once datafile is copied.  I guess I could have also changed the script to be run by SYS rather than SYSTEM as another option.

So where portion of script to generate copy all datafiles previously looked like this:

select 'alter tablespace '||tablespace_name||' begin backup;' sqlline,

       'host ocopy '||file_name||' <backup_dest>;' sqlline,

       'alter tablespace '||tablespace_name||' end backup;'

from dba_data_files;

It now looks like this:

select 'execute sys.begin_bk_mode;' from dual;

select 'host ocopy '||file_name||' <backup_dest>' from dba_data_files where tablespace_name = 'SYSAUX'

select 'execute sys.end_bk_mode;' from dual;

select 'alter tablespace '||tablespace_name||' begin backup;' sqlline,

       'host ocopy '||file_name||' <backup_dest>;' sqlline,

       'alter tablespace '||tablespace_name||' end backup;'

from dba_data_files where tablespace_name not like upper('SYSAUX');

Wondering if any out there still use user managed backups with 12.2.x, and how you dealt with this.

Comments
Post Details
Added on Oct 15 2019
5 comments
1,272 views