{"id":11476,"date":"2016-05-18T13:59:42","date_gmt":"2016-05-18T18:59:42","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=11476"},"modified":"2016-05-18T13:59:42","modified_gmt":"2016-05-18T18:59:42","slug":"bash-example-backup-multiple-oracle-user-schema","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=11476","title":{"rendered":"Bash Example: Backup Multiple Oracle User Schema"},"content":{"rendered":"<div class='toc wptoc'>\n<h2>Contents<\/h2>\n<ol class='toc-odd level-1'>\n\t<li>\n\t\t<a href=\"#Example\">Example<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#References\">References<\/a>\n\t<\/li>\n\t<li>\n\t\t<a href=\"#\"><\/a>\n\t\t<ol class='toc-even level-2'>\n\t\t\t<li>\n\t\t\t\t<a href=\"#_1\"><\/a>\n\t\t\t<\/li>\n<\/ol>\n<\/ol>\n<\/ol>\n<\/div>\n<div class='wptoc-end'>&nbsp;<\/div>\n<span id=\"Example\"><h2>Example<\/h2><\/span>\n<pre lang=\"sql\">\r\n#!\/bin\/sh\r\n\r\nbackup_dir=\/backup\/db\r\ndb_sid=orcl\r\n\r\ndeclare -A usrs\r\nusrs[scott]=tiger\r\nusrs[hr]=hr\r\n\r\ncurr_ts=`date +\"%m-%d-%y_%H-%M-%S\"`\r\ncurr_backup_dir=${backup_dir}\/${curr_ts}\r\nmkdir -p ${curr_backup_dir}\r\n\r\nfor k in \"${!usrs[@]}\"\r\ndo\r\n\techo \"Backing up ${k}...\"\r\n\texpcmd=\"exp ${k}\/${usrs[$k]}@${db_sid} owner=${k} grants=y rows=y compress=y file=${curr_backup_dir}\/${k}.exp log=${curr_backup_dir}\/${k}.log &\"\r\n\techo \"export command is: ${expcmd}\"\r\n\techo \"done.\"\r\n\techo \"\"\r\ndone\r\n\r\necho \"All done.\"\r\n\r\n<\/pre>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <a href=\"http:\/\/www.linuxjournal.com\/content\/bash-associative-arrays\">Bash Associative Arrays<\/a><\/p>\n<span id=\"\"><h2><\/h2><\/span>\n<span id=\"_1\"><h3><\/h3><\/span>\n<span id=\"_2\"><h6><\/h6><\/span>\n<pre lang=\"sql\">\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Example #!\/bin\/sh backup_dir=\/backup\/db db_sid=orcl declare -A usrs usrs[scott]=tiger usrs[hr]=hr curr_ts=`date +&#8221;%m-%d-%y_%H-%M-%S&#8221;` curr_backup_dir=${backup_dir}\/${curr_ts} mkdir -p ${curr_backup_dir} for k in &#8220;${!usrs[@]}&#8221; do echo &#8220;Backing up ${k}&#8230;&#8221; expcmd=&#8221;exp ${k}\/${usrs[$k]}@${db_sid} owner=${k} grants=y rows=y compress=y file=${curr_backup_dir}\/${k}.exp log=${curr_backup_dir}\/${k}.log &#038;&#8221; echo &#8220;export command is: ${expcmd}&#8221; echo &#8220;done.&#8221; &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=11476\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[35,65],"tags":[702,158,507,226,567],"class_list":["post-11476","post","type-post","status-publish","format-standard","hentry","category-oracle","category-shell","tag-array","tag-backup","tag-bash","tag-example","tag-oracle"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-2Z6","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11476"}],"version-history":[{"count":1,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11476\/revisions"}],"predecessor-version":[{"id":11477,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/11476\/revisions\/11477"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}