{"id":1513,"date":"2013-11-30T11:41:51","date_gmt":"2013-11-30T11:41:51","guid":{"rendered":"http:\/\/kb.esds.co.in\/?p=1513"},"modified":"2017-11-30T06:24:21","modified_gmt":"2017-11-30T06:24:21","slug":"connecting-managing-pluggable-database","status":"publish","type":"post","link":"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/","title":{"rendered":"Connecting &#038; Managing Pluggable Database"},"content":{"rendered":"<p>In previous article we saw the process for creating Container and Pluggable Databases using Database Configuration Assistance (DBCA). There are difference in connecting to pluggable database as compared to those of container database and databases in previous releases. Also the way we need startup and shutdown the pluggable database.<\/p>\n<p>It is really surprising and interesting to know, when we start the container database, all the pluggable database within are automatically mounted. There is no special mechanism to start pluggable database when we start the container database. We can manage the pluggable database in two ways:<\/p>\n<ol>\n<li>When connected to pluggable database itself, we can use SQL*Plus commands to startup and shutdown the database.<\/li>\n<li>When connected to Container database, we can use \u201cAlter Pluggable Database\u201d commands with various options.<\/li>\n<\/ol>\n<p><strong><i>Connecting to Container Database<\/i><\/strong><\/p>\n<p><b>\u00a0<\/b>We created the container database named <strong>CBD<\/strong>.<b><i><\/i><\/b><\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1515\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image001.jpg\" alt=\"image001\" width=\"675\" height=\"264\" \/><\/p>\n<p>To check the services under container database, and information of which pluggable database it holds, you can use the dictionary view V$SERVICES<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1516\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image002.jpg\" alt=\"image002\" width=\"675\" height=\"264\" \/><\/p>\n<p>To get the details of all the services, you can use \u201clsnrctl\u201d utility<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1517\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image003.jpg\" alt=\"image003\" width=\"675\" height=\"377\" \/><\/p>\n<p>You can get the details of current container with 2 methods as show:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1518\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image004.jpg\" alt=\"image004\" width=\"675\" height=\"264\" \/><\/p>\n<p>You can switch to container inside container simply with \u201cAlter Session Set\u201d Command as:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1519\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image005.jpg\" alt=\"image005\" width=\"675\" height=\"264\" \/><\/p>\n<p><strong><i>Connecting to pluggable database<\/i><\/strong><\/p>\n<p>You can connect to pluggable database using \u201ctnsname\u201d or direct connect using service name. Connect to database and make sure that you are connected to appropriate database as:<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1520\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image006.jpg\" alt=\"image006\" width=\"675\" height=\"245\" \/><\/p>\n<p><strong><i>Start up and Shut Down Pluggable database.<\/i><\/strong><\/p>\n<p>Startup and Shutdown process is simple as that of databases of previous releases. There is difference in managing pluggable database. When connected to container database, you can use \u201cAlter Pluggable database\u201d statements to manage the database. Some examples of the same are given below.<\/p>\n<p><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1521\" src=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image007.jpg\" alt=\"image007\" width=\"675\" height=\"245\" \/><\/p>\n<p>Following are possible options to perform startup operations on pluggable database:<\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE &lt;pdb_name&gt;OPEN READ WRITE [RESTRICTED] [FORCE];<\/i><\/strong><\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE &lt;pdb_name&gt; OPEN READ ONLY [RESTRICTED] [FORCE];<\/i><\/strong><\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE &lt;pdb_name&gt; OPEN UPGRADE [RESTRICTED];<\/i><\/strong><\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE &lt;pdb_name&gt; CLOSE [IMMEDIATE];<\/i><\/strong><\/p>\n<p>If you have multiple pluggable database, \u201cAlter Pluggable Database\u201d can be used manage one or more database with single command. You need to specify the names of pluggable database as below:<\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE &lt;pdb_1_name&gt;,&lt;pdb_2_name&gt; [OPEN]\/[CLOSE];<\/i><\/strong><\/p>\n<p>In case your container has few pluggable database and you wish to keep some of them shutdown and start rest you can use \u201cAlter Pluggable database\u2026EXPECT\u201d command, as:<\/p>\n<p><strong><i>ALTER PLUGGABLE DATABASE ALL EXPECT pdb OPEN;<\/i><\/strong><\/p>\n<p>As said earlier that there is no special mechanism to start pluggable database when we start the container database, but we can achieve that creating the trigger on container database when starts to perform the startup of the pluggable databases automatically within it.<\/p>\n<p><strong><i>CREATE OR REPLACE TRIGGER openallpluggabledatabases <\/i><\/strong><\/p>\n<p><strong><i>\u00a0 AFTER STARTUP ON DATABASE <\/i><\/strong><\/p>\n<p><strong><i>BEGIN <\/i><\/strong><\/p>\n<p><strong><i>\u00a0\u00a0 EXECUTE IMMEDIATE &#8216;ALTER PLUGGABLE DATABASE ALL OPEN&#8217;; <\/i><\/strong><\/p>\n<p><strong><i>END openallpluggabledatabase;<\/i><\/strong><\/p>\n<p><strong><i>\/<\/i><\/strong><\/p>\n<p>This was all about connecting and managing startup\/shutdown of pluggable databases. In coming article we shall understand how to view the information\/properties of container and pluggable database using data dictionary view or SQL*Plus.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In previous article we saw the process for creating Container and Pluggable Databases using Database Configuration Assistance (DBCA). There are difference in connecting to pluggable database as compared to those of container database and databases in previous releases. Also the way we need startup and shutdown the pluggable database. It is really surprising and interesting&#8230; <\/p>\n<div class=\"clear\"><\/div>\n<p><a href=\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\" class=\"gdlr-button small excerpt-read-more\">Read More<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[196],"tags":[601],"aioseo_notices":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.9.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Connecting &amp; Managing Pluggable Database<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Connecting &amp; Managing Pluggable Database\" \/>\n<meta property=\"og:description\" content=\"In previous article we saw the process for creating Container and Pluggable Databases using Database Configuration Assistance (DBCA). There are difference in connecting to pluggable database as compared to those of container database and databases in previous releases. Also the way we need startup and shutdown the pluggable database. It is really surprising and interesting... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\" \/>\n<meta property=\"og:site_name\" content=\"ESDS Official Knowledgebase\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ESDSdc\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-30T11:41:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-11-30T06:24:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image001.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ESDSDataCenter\" \/>\n<meta name=\"twitter:site\" content=\"@ESDSDataCenter\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"3 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"ESDS Official Knowledgebase\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.esds.co.in\/kb\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.esds.co.in\/kb\/wp-content\/uploads\/2013\/11\/image001.jpg\",\"width\":624,\"height\":264},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/#webpage\",\"url\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\",\"name\":\"Connecting & Managing Pluggable Database\",\"isPartOf\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/#primaryimage\"},\"datePublished\":\"2013-11-30T11:41:51+00:00\",\"dateModified\":\"2017-11-30T06:24:21+00:00\",\"author\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/bfa449a2dfe03e455a275e9e43d3ffcf\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\",\"url\":\"https:\/\/www.esds.co.in\/kb\/connecting-managing-pluggable-database\/\",\"name\":\"Connecting &#038; Managing Pluggable Database\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#\/schema\/person\/bfa449a2dfe03e455a275e9e43d3ffcf\",\"name\":\"Kapil Relan\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.esds.co.in\/kb\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d7a17afad245f4af821da4a6d373e430?s=96&d=mm&r=g\",\"caption\":\"Kapil Relan\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/1513"}],"collection":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/comments?post=1513"}],"version-history":[{"count":7,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/1513\/revisions"}],"predecessor-version":[{"id":3416,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/posts\/1513\/revisions\/3416"}],"wp:attachment":[{"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/media?parent=1513"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/categories?post=1513"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esds.co.in\/kb\/wp-json\/wp\/v2\/tags?post=1513"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}