SPFILE for a CDB vs. a PDB
Recently, I have had conversations with users about Oracle Database 12c. One question that often comes up is, how does the database manage the parameters between a container database (CDB) and a pluggable database (PDB)? In order to answer this question, I had to work with my pluggable database setup in a test environment. Before changing anything within my database setup I first made a backup of the current parameters using a tired and true method.
SQL> create pfile=’init12ctest.ora’ from spfile;
Before diving into change and storage of parameters, it is important that you understand the concept of inheritance. Once you under stand inheritance within the Oracle Database 12c, you will grasp how parameters can be changed and stored for PDBs.
Inheritance
Inheritance in dealing with Oracle Database 12c means that the value of a particular parameter in the root (CDB) is inherited by one or more PDBs. There are parameters that can be changed at the PDB level and override what is being inherited from the CDB. To identify which parameters can be modified for a PDB, the ISPDB_MODIFIABLE column in the V$SYSTEM_PARAMETER view must be TRUE. If the ISPDB_MODIFIABLE is TRUE then the parameter inherits the value from the CDB until it is changed with an ALTER SYSTEM SET command at the PDB.
Setting Parameters
Now, let’s work on changing parameters for a PDB. In order to do this, you needed to navigate into a PDB using the ALTER SESSION SET CONTAINER command.
SQL> ALTER SESSION SET CONTAINER=bcpdb1;
Once inside of the PDB, you needed to find what parameters are modifiable. These parameters can be found using the following SQL statement. Remember, the ISPDB_MODIFIABLE has to be TRUE.
SQL> SELECT NAME FROM V$SYSTEM_PARAMETER
WHERE ISPDB_MODIFIABLE = ‘TRUE’
ORDER BY NAME;
With this list of parameters, pick one at random to change. Lets change the statistics_level from typical to all for bcpdb1.
SQL> ALTER SYSTEM SET STATISTICS_LEVEL = ALL SCOPE = BOTH;
By using BOTH, you are setting the parameter in memory and in the spfile. This way on a reboot of the database, the PDB will retain the setting.
Now that the parameter has been changed, can you see this change in the parameters for the CDB? Not at the CDB level, but you can at the PDB level from the V$PARAMETER. If I want to see the parameters that are set system wide (CDB & PDB), you needed to use the view V$SYSTEM_PARAMETER. The following SQL will display the statistics_level parameter for both CDB and PDB (make note of the con_id column).
SQL> SELECT NAME, VALUE, DISPLAY_VALUE, CON_ID FROM V$SYSTEM_PARAMETER
WHERE NAME = ‘statistics_level’
ORDER BY NAME;
At this point, you have two different settings for statistics_level depending on which container you are in. Now, you’ll want to make a backup of the spfile and verify that your settings for the PDB is in fact stored in the spfile.
SQL> CREATE PFILE=’init12ctest1.ora’ FROM SPFILE;
Let’s take a look at the pfile you just created.
bc12c.__data_transfer_cache_size=0
bc12c.__db_cache_size=1442840576
bc12c.__java_pool_size=16777216
bc12c.__large_pool_size=33554432
bc12c.__oracle_base=’/oracle/app’#ORACLE_BASE set from environment
bc12c.__pga_aggregate_target=1073741824
bc12c.__sga_target=2147483648
bc12c.__shared_io_pool_size=117440512
bc12c.__shared_pool_size=503316480
bc12c.__streams_pool_size=16777216
bc12c._common_user_prefix=’CU’##
*.audit_file_dest=’/oracle/app/admin/bc12c/adump’
*.audit_trail=’db’
*.compatible=’12.1.0.0.0′
*.control_files=’/oracle/app/oradata/BC12C/controlfile/o1_mf_91pqwlwo_.ctl’,’/oracle/app/fast_recovery_area/BC12C/controlfile/o1_mf_91pqwm7g_.ctl’
*.db_block_size=8192
*.db_create_file_dest=’/oracle/app/oradata’
*.db_domain=’acme.com’
*.db_name=’bc12c’
*.db_recovery_file_dest=’/oracle/app/fast_recovery_area’
*.db_recovery_file_dest_size=16106127360
*.diagnostic_dest=’/oracle/app’
*.dispatchers='(PROTOCOL=TCP) (SERVICE=bc12cXDB)’
*.enable_pluggable_database=true
*.local_listener=’LISTENER_BC12C’
*.log_archive_format=’%t_%s_%r.dbf’
*.open_cursors=300
*.pga_aggregate_target=1073741824
*.processes=300
*.remote_login_passwordfile=’EXCLUSIVE’
*.sga_max_size=2147483648
*.sga_target=2147483648
*.undo_tablespace=’UNDOTBS1′
Notice that the parameter statistics_level is not included in the output for the pfile. Why is this? If you go back to the documentation on Oracle Database 12c (here), you will find a note stating:
Note: A text initialization parameter file (PFILE) cannot contain PDB-specific parameter values.
Where are the parameters stored
Since the parameters for the PDB are not stored in the spfile, where are they stored then? In order to find this, you need to take the V$SYSTEM_PARAMETER view apart using GV$FIXED_VIEW_DEFINITION.
SQL> SELECT VIEW_DEFINITION FROM GV$FIXED_VIEW_DEFINITION
WHERE VIEW_NAME = ‘V$SYSTEM_PARAMETER’;
The V$SYSTEM_PARAMETER view points you to the GV$SYSTEM_PARAMETER view. Let’s grab the definition for this view.
SQL> SELECT VIEW_DEFINITION FROM GV$FIXED_VIEW_DEFINITION
WHERE VIEW_NAME = ‘GV$SYSTEM_PARAMETER’;
The definition for GV$SYSTEM_PARAMTER shows you that the information is coming from the X$KSPPI and X$KSPPSV tables in the data dictionary. The SQL that defines the GV$SYSTEM_PARAMETER view is listed below.
select x.inst_id,x.indx+1,ksppinm,ksppity,ksppstvl, ksppstdvl, ksppstdf,
decode(bitand(ksppiflg/256,1),1,’TRUE’,’FALSE’),
decode(bitand(ksppiflg/65536,3),1,’IMMEDIATE’,2,’DEFERRED’, 3,’IMMEDIATE’,’FALSE’),
decode(bitand(ksppiflg/524288,1),1,’TRUE’,’FALSE’),
decode(bitand(ksppiflg,4),4,’FALSE’,
decode(bitand(ksppiflg/65536,3), 0, ‘FALSE’, ‘TRUE’)),
decode(bitand(ksppstvf,7),1,’MODIFIED’,’FALSE’),
decode(bitand(ksppstvf,2),2,’TRUE’,’FALSE’),
decode(bitand(ksppilrmflg/64, 1), 1, ‘TRUE’, ‘FALSE’),
decode(bitand(ksppilrmflg/268435456, 1), 1, ‘TRUE’, ‘FALSE’),
ksppdesc, ksppstcmnt, ksppihash, y.con_id
from x$ksppi x, x$ksppsv y
where (x.indx = y.indx)
and bitand(ksppiflg,268435456) = 0
and ((translate(ksppinm,’_’,’#’) not like ‘##%’)
and ((translate(ksppinm,’_’,’#’) not like ‘#%’)
or (ksppstdf = ‘FALSE’)
or (bitand(ksppstvf,5) > 0)))
Now that you know the X tables to use, let’s take a look and see if you can locate the statistics_level parameter for bcpdb1.
SQL> SELECT * FROM X$KSPPSV
WHERE INDX IN (SELEC
T INDX FROM X$KSPPI WHERE CON_ID= 3 AND KSPPINM = ‘statistics_level’);
Notice that the CON_ID is 3. If you query CDB_PDB, you will notice that bcpdb1 has CON_ID of 3. At this point, you have located where the value of statistics_level for the PDB is stored. If you go back to the documentation, you will find references that tell you if SCOPE=SPFILE or SCOPE=BOTH were used when setting the parameter; the parameter will be transferred and stored in the XML file when the PDB is unplugged from the CDB. Let’s test this out.
Unplug a PDB
To test if the parameter (statistics_level) is stored in the XML file or data dictionary. What happens to the parameter when you unplug the PDB. According to documentation when unplugged the value of statistics_level should be stored in the associated XML file for plugging into a CDB. Let’s unplug BCPDB1.
SQL> ALTER PLUGGABLE DATABASE BCPDB1 CLOSE;
SQL> ALTER PLUGGABLE DATABASE BCPDB1 UNPLUG TO ‘/TMP/BCPDB1.XML’;
SQL> DROP PLUGGABLE DATABASE BCPDB1 KEEP DATAFILES;
With the pluggable database BCPDB1 unplugged from the CDB, lets see if the parameter values for statistics_level are still in the data dictionary.
SQL> SELECT * FROM X$KSPPSV
WHERE INDX IN (SELECT INDX FROM X$KSPPI WHERE CON_ID= 3 AND KSPPINM = ‘statistics_level’);
Apparently, the parameter values for statistics_level are gone. Let’s check the XML file that was created in the /tmp directory to see if the parameter is there.
<parameters>
<parameter>processes=300</parameter>
<parameter>sga_max_size=2147483648</parameter>
<parameter>sga_target=2147483648</parameter>
<parameter>db_block_size=8192</parameter>
<parameter>compatible=12.1.0.0.0</parameter>
<parameter>open_cursors=300</parameter>
<parameter>pga_aggregate_target=1073741824</parameter>
<parameter>enable_pluggable_database=TRUE</parameter>
<parameter>_common_user_prefix=CU</parameter>
</parameters>
The values that are in the XML file appear to be just general settings. The statistics_level parameter didn’t make it into the XML file either. Hmmm… Let’s plug in the PDB and see if the value comes back to the data dictionary.
Plug-in the PDB
In order to plug-in the PDB make sure you still have the data files and the XML file needed. What you are hoping for is that the statistic_level parameter comes back for the PDB and is set to a value of ALL.
SQL> CREATE PLUGGABLE DATABASE BCPDB1 USING ‘/TMP/BCPDB1.XML’ NOCOPY;
SQL> ALTER PLUGGABLE DATABASE BCPDB1 OPEN;
With the PDB (BCPDB1) open, let’s check and see if the statistic_level parameter is in the data dictionary.
SQL> SELECT * FROM X$KSPPSV
WHERE INDX IN (SELECT INDX FROM X$KSPPI WHERE CON_ID= 3 AND KSPPINM = ‘statistics_level’);
Sure enough, the statistics_level parameter came back. This means that the parameters for the PDB are stored in the PDB data dictionary. 🙂
Conclusion
When working with Oracle Database 12c, you have to understand how the initialization parameters are set for the CDB and each of the PDBs associated. The traditional ways of looking at an SPFILE will only be useful for a CDB database. This is because the CDB is the root level that controls many of the items which are shared amongst the CDB and PDBs. In order to fully understand how parameters are set for a PDB, you need to remember that PDBs inherit parameter values from a CDB; unless they are overridden from the PDB level.
Enjoy!
twitter: @dbasolved
blog: http://dbasolved.com
Current Oracle Certs
Bobby Curtis
I’m Bobby Curtis and I’m just your normal average guy who has been working in the technology field for awhile (started when I was 18 with the US Army). The goal of this blog has changed a bit over the years. Initially, it was a general blog where I wrote thoughts down. Then it changed to focus on the Oracle Database, Oracle Enterprise Manager, and eventually Oracle GoldenGate.
If you want to follow me on a more timely manner, I can be followed on twitter at @dbasolved or on LinkedIn under “Bobby Curtis MBA”.
I’ve learn a few excellent stuff here. Definitely worth bookmarking for revisiting. I surprise how much attempt you place to make such a excellent informative site.
great points altogether, you just gained a brand new reader. What would you recommend in regards to your post that you made some days ago? Any positive?
I was able to find good advice from your articles.
I have read so many articles on the topic of the blogger lovers but this piece of writing is actually a pleasant article, keep it up.
Thank you for sharing most of these wonderful articles. In addition, the perfect travel in addition to medical insurance plan can often eliminate those problems that come with traveling abroad. The medical emergency can soon become very costly and that’s certain to quickly put a financial stress on the family finances. Setting up in place the great travel insurance bundle prior to leaving is well worth the time and effort. Thanks
What a data of un-ambiguity and preserveness of precious familiarity about unpredicted feelings.
Good post. I learn something new and challenging on websites I stumbleupon everyday. It will always be helpful to read through articles from other writers and practice something from other websites.
I really desire to share it with you that I am new to posting and thoroughly valued your review. Very likely I am likely to remember your blog post . You truly have stunning article materials.
Great work! That is the kind of info that should be shared around the web. Shame on Google for no longer positioning this put up higher! Come on over and consult with my website . Thanks =)
Pretty section of content. I just stumbled upon your weblog and in accession capital to assert that I get in fact enjoyed account your blog posts. Anyway I will be subscribing to your feeds and even I achievement you access consistently quickly.
I wanted to thank you for this excellent read!! I absolutely loved every little bit of it. I’ve got you bookmarked to check out new things you post…
I am actually glad to glance at this website posts which consists of plenty of valuable data, thanks for providing such data.
I am truly delighted to glance at this webpage posts which contains plenty of useful facts, thanks for providing these data.
you are in reality a good webmaster. The site loading pace is amazing. It seems that you are doing any unique trick. In addition, The contents are masterpiece. you’ve done a fantastic activity on this matter!
I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. All the best
I do not even understand how I finished up right here, but I believed this submit was great. I don’t realize who you are but definitely you are going to a well-known blogger in case you aren’t already. Cheers!
Thanks for sharing such a nice idea, piece of writing is pleasant, thats why i have read it completely
This paragraph gives clear idea in favor of the new visitors of blogging, that really how to do running a blog.
Hi there, I discovered your website by way of Google whilst searching for a comparable subject, your website got here up, it seems great. I’ve bookmarked it in my google bookmarks.
Hi there, just became aware of your blog thru Google, and found that it’s truly informative. I am going to be careful for brussels. I will appreciate in case you continue this in future. Lots of people will likely be benefited from your writing. Cheers!
Appreciating the time and effort you put into your blog and detailed information you offer. It’s awesome to come across a blog every once in a while that isn’t the same out of date rehashed material. Wonderful read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.
Incredible quest there. What occurred after? Good luck!
Your blog is a breath of fresh air in the often mundane world of online content. Your unique perspective and engaging writing style never fail to leave a lasting impression. Thank you for sharing your insights with us.
Very nice post. I just stumbled upon your blog and wished to say that I’ve really enjoyed surfing around your blog posts. After all I will be subscribing to your rss feed and I hope you write again very soon!
Nice Article
I absolutely love your site.. Excellent colors & theme. Did you make this site yourself? Please reply back as I’m hoping to create my own website and would love to find out where you got this from or what the theme is named. Many thanks!
It’s amazing to go to see this website and reading the views of all colleagues concerning this paragraph, while I am also eager of getting knowledge.
Quality articles is the secret to invite the users to pay a quick visit the website, that’s what this website is providing.
Do you mind if I quote a few of your posts as long as I provide credit and sources back to your weblog? My blog site is in the exact same niche as yours and my users would really benefit from some of the information you present here. Please let me know if this alright with you. Many thanks!
Your article helped me a lot, is there any more related content? Thanks!
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Appreciate it!
Good day! This is kind of off topic but I need some advice from an established blog. Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to start. Do you have any ideas or suggestions? Thanks
Hi there it’s me, I am also visiting this web page regularly, this website is actually good and the people are in fact sharing fastidious thoughts.
I’m curious to find out what blog system you are using? I’m having some minor security issues with my latest website and I’d like to find something more secure. Do you have any suggestions?
Awesome blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog shine. Please let me know where you got your design. Many thanks
Hey, I loved your post! Visit my site: ANCHOR.
Thank you a bunch for sharing this with all of us you actually recognize what you’re talking approximately! Bookmarked. Please also discuss with my site =). We could have a hyperlink exchange arrangement between us
Cool blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog stand out. Please let me know where you got your theme. Thanks a lot
Hi there! I know this is somewhat off topic but I was wondering which blog platform are you using for this site? I’m getting sick and tired of WordPress because I’ve had problems with hackers and I’m looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.
I used to be able to find good information from your articles.
My family every time say that I am killing my time here at net, however I know I am getting know-how every day by reading such pleasant content.
It’s appropriate time to make a few plans for the future and it is time to be happy. I’ve learn this put up and if I may just I desire to recommend you few interesting things or suggestions. Maybe you could write next articles referring to this article. I want to learn more things approximately it!
Serious Use Alternative 1 indapamide and paroxetine both increase QTc interval clomid for men buy online
Does your site have a contact page? I’m having problems locating it but, I’d like to send you an e-mail. I’ve got some ideas for your blog you might be interested in hearing. Either way, great blog and I look forward to seeing it develop over time.
It’s a pity you don’t have a donate button! I’d most certainly donate to this fantastic blog! I guess for now i’ll settle for book-marking and adding your RSS feed to my Google account. I look forward to new updates and will talk about this site with my Facebook group. Chat soon!
It is in reality a nice and helpful piece of info. I am glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.
Awesome! Its in fact remarkable paragraph, I have got much clear idea on the topic of from this paragraph.
I have realized some new points from your web-site about computers. Another thing I have always considered is that computers have become something that each household must have for many reasons. They supply you with convenient ways to organize households, pay bills, shop, study, tune in to music as well as watch tv series. An innovative approach to complete these tasks has been a laptop computer. These personal computers are mobile ones, small, powerful and transportable.
Thanks for expressing your ideas. Another thing is that learners have an alternative between federal government student loan along with a private student loan where it’s easier to choose student loan debt consolidation loan than with the federal student loan.
Please let me know if you’re looking for a author for your weblog. You have some really great posts and I feel I would be a good asset. If you ever want to take some of the load off, I’d absolutely love to write some content for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Cheers!
Having read this I believed it was really enlightening. I appreciate you taking the time and effort to put this informative article together. I once again find myself spending a lot of time both reading and posting comments. But so what, it was still worth it!
I’m not sure where you are getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for wonderful information I was looking for this information for my mission.
I enjoy what you guys tend to be up too. Such clever work and reporting! Keep up the terrific works guys I’ve added you guys to our blogroll.
I read this post fully on the topic of the resemblance of newest and previous technologies, it’s amazing article.
Hey just wanted to give you a quick heads up. The text in your article seem to be running off the screen in Safari. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let you know. The design and style look great though! Hope you get the issue resolved soon. Thanks
If you are going for best contents like I do, just pay a visit this web page every day as it presents quality contents, thanks