{"id":121,"date":"2019-02-19T09:19:17","date_gmt":"2019-02-19T08:19:17","guid":{"rendered":"http:\/\/oracledba.fr\/?p=121"},"modified":"2020-05-29T14:43:24","modified_gmt":"2020-05-29T12:43:24","slug":"utiliser-des-variables-dans-les-scripts-rman","status":"publish","type":"post","link":"https:\/\/oracledba.fr\/?p=121","title":{"rendered":"Using variables in RMAN"},"content":{"rendered":"\n<p>When using RMAN catalog it is preferred to use backup script stored in catalog. It is best if scripts can be reused for different retention.<\/p>\n\n\n\n<p>You can use variables in RMAN script this way:<\/p>\n\n\n\n<pre lang=\"sql\">create global script global_backup_full_database \ncomment 'backup full of database. Parameter sysdate+n,tag db, tag archivelog'\n{\nallocate channel c1 type SBT_TAPE PARMS 'BLKSIZE=1048576,SBT_LIBRARY=\/usr\/lib\/ddbda\/libddboostora.so, ENV=(CONFIG_FILE=\/opt\/ddbda\/config\/oracle_ddbda.cfg)' FORMAT '%d_%U';\nbackup as backupset database filesperset 1 keep until time '&amp;1' tag &amp;2;\nbackup as backupset archivelog all delete input filesperset=1 keep until time '&amp;1' tag &amp;3;\n}\n<\/pre>\n\n\n\n<!--more Lire la suite!-->\n\n\n\n<p>You can then call the script from rman this way:<\/p>\n\n\n\n<pre lang=\"sql\"> \nRUN\n{ \n  EXECUTE SCRIPT global_backup_full_database \n    USING 'sysdate+15'\n          backup_daily_db\n          backup_daily_arch;\n} \n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When using RMAN catalog it is preferred to use backup script stored in catalog. It is best if scripts can be reused for different retention. You can use variables in RMAN script this way: create global script global_backup_full_database comment &#8216;backup full of database. Parameter sysdate+n,tag db, tag archivelog&#8217; { allocate channel c1 type SBT_TAPE PARMS &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/oracledba.fr\/?p=121\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Using variables in RMAN&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-121","post","type-post","status-publish","format-standard","hentry","category-rman"],"_links":{"self":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":8,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/oracledba.fr\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions\/211"}],"wp:attachment":[{"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oracledba.fr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}