{"id":6733,"date":"2019-03-19T11:48:32","date_gmt":"2019-03-19T11:48:32","guid":{"rendered":"https:\/\/ittutorial.org\/?p=6733"},"modified":"2020-05-13T12:28:25","modified_gmt":"2020-05-13T12:28:25","slug":"oracle-database-12c-parameter-files-spfile-pfile-create-pfile-from-spfile","status":"publish","type":"post","link":"https:\/\/ittutorial.org\/oracle-database-12c-parameter-files-spfile-pfile-create-pfile-from-spfile\/","title":{"rendered":"Oracle Database 12c Parameter Files ( Spfile &#038; Pfile )"},"content":{"rendered":"<p>Hi,<\/p>\n<p>In this article, I will explain the parameter files that are very important for Oracle database. This parameter is created when opening the Oracle instance and then we can change the contents of these parameter files either dynamically or statically.Oracle In our database there are 2 identical parameter files, which are named SPFILE and PFILE. I will examine both of them separately below.<\/p>\n<p><a href=\"http:\/\/salihdeveci.files.wordpress.com\/2013\/10\/spfile.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3311\" src=\"http:\/\/salihdeveci.files.wordpress.com\/2013\/10\/spfile.gif\" alt=\"spfile\" width=\"404\" height=\"285\" \/><\/a><!--more--><\/p>\n<p>&nbsp;<\/p>\n\n<p><strong>SPFILE (Server Parameter File):<\/strong> It is a physical file with .ora extension in binary format where the parameters required for configuring the instance are stored when opening Oracle instance. This file is typically located under the $ ORACLE_HOME\/dbs directory and <strong>spfile&lt;ORACLE_SID&gt;.ora<\/strong> format. We can say that this file is Oracle Instance configuration file that all parameters are kept for startup of Oracle instance<\/p>\n\n<p>You can also find the location of this file from the database as follows.<\/p>\n<pre>[oracle@MehmetSalih ~]$ sqlplus \/ as sysdba\r\n\r\nSQL*Plus: Release 12.2.0.1.0 Production on Tue Mar 1 14:26:31 2019\r\n\r\nCopyright (c) 1982, 2016, Oracle.  All rights reserved.\r\n\r\nConnected to:\r\nOracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production\r\n\r\nSQL&gt; show parameter spfile\r\n\r\nNAME                                 TYPE        VALUE\r\n------------------------------------ ----------- ------------------------------\r\nspfile                               string      \/oracle\/product\/12.1.2\/db\/dbs\/\r\n                                                 spfileDEVECI.ora\r\nSQL&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>This file is used in the nomount step when starting the database, where the following parameters are read by Oracle Instance. The instance cannot be started without a spfile or pfile file because the controlfile&#8217;s address, which is the brain of the database, is contained in this parameter file. Because this file is in binary format, we cannot open it directly, but we can convert it to user-understandable form using strings as follows. To describe the importance of the Spfile, I will list the parameters in this parameter file as follows.<\/p>\n\n<p>&nbsp;<\/p>\n<pre>[oracle@MehmetSalih ~]$ strings \/oracle\/product\/12.1.2\/db\/dbs\/spfileDEVECI.ora\r\nDEVECIDB.__data_transfer_cache_size=0\r\nDEVECI.__data_transfer_cache_size=0\r\nDEVECIDB.__db_cache_size=2818572288\r\nDEVECI.__db_cache_size=2332033024\r\nDEVECIDB.__inmemory_ext_roarea=0\r\nDEVECI.__inmemory_ext_roarea=0\r\nDEVECIDB.__inmemory_ext_rwarea=0\r\nDEVECI.__inmemory_ext_rwarea=0\r\nDEVECIDB.__java_pool_size=16777216\r\nDEVECI.__java_pool_size=16777216\r\nDEVECIDB.__large_pool_size=33554432\r\nDEVECI.__large_pool_size=33554432\r\nDEVECIDB.__oracle_base='\/oracle\/product'#ORACLE_BASE set from environment\r\nDEVECI.__oracle_base='\/oracle\/product'#ORACLE_\r\nBASE set from environment\r\nDEVECIDB.__pga_aggregate_target=1191182336\r\nDEVECI.__pga_aggregate_target=1191182336\r\nDEVECIDB.__sga_target=3774873600\r\nDEVECI.__sga_target=3774873600\r\nDEVECIDB.__shared_io_pool_size=201326592\r\nDEVECI.__shared_io_pool_size=201326592\r\nDEVECIDB.__shared_pool_size=687865856\r\nDEVECI.__shared_pool_size=1174405120\r\nDEVECIDB.__streams_pool_size=0\r\nDEVECI.__streams_pool_size=0\r\n*.audit_file_dest='\/oracle\/product\/admin\/DEVECIDB\/adump'\r\n*.audit_trail='db'\r\n*.compatible='12.2.0'\r\n<strong>*.control_files='\/u01\/oradata\/DEVECIDB\/control01.ctl','\/oracle\/product\/fast_recovery_area\/DEVECIDB\/control02.ctl'<\/strong>\r\n<strong>*.db_block_size=8192<\/strong>\r\n<strong>*.db_name='DEVECIDB'<\/strong>\r\n*.db_recovery_file_dest='\/oracle\/product\/fast_recovery_area\/DEVECIDB'\r\n*.db_recovery_file_dest_size=10g\r\n*.diagnostic_dest='\/oracle\/product'\r\n*.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVECIDBXDB)'\r\n*.local_listener='LISTENER_DEVECIDB'\r\n*.log_archive_format='%t_%s_%r.dbf'\r\n*.nls_language='AMERICAN'\r\n*.nls_territory='AMERICA'\r\n*.open_cursors=300\r\n*.pga_aggregate_target=1121m\r\n*.processes=300\r\nemote_login_passwordfile='EXCLUSIVE'\r\n*.sga_target=3600m\r\n*.undo_tablespace='UNDOTBS1'\r\n[oracle@MehmetSalih ~]$<\/pre>\n<p>&nbsp;<\/p>\n<p>I have specified some of the very important parameters above in\u00a0 bold letters, without reading these parameters Oracle cannot start instance. When the database is first started, we can query the parameters that should and should be very important from the database as follows.<\/p>\n\n<p>&nbsp;<\/p>\n<pre>SQL&gt; select name from v$parameter where isbasic='TRUE';\r\n\r\nNAME\r\n--------------------------------------------------------------------------------\r\nprocesses\r\nsessions\r\nnls_language\r\nnls_territory\r\nsga_target\r\ncontrol_files\r\ndb_block_size\r\ncompatible\r\nlog_archive_dest_1\r\nlog_archive_dest_2\r\nlog_archive_dest_state_1\r\n\r\nNAME\r\n--------------------------------------------------------------------------------\r\nlog_archive_dest_state_2\r\ncluster_database\r\ndb_create_file_dest\r\ndb_create_online_log_dest_1\r\ndb_create_online_log_dest_2\r\ndb_recovery_file_dest\r\ndb_recovery_file_dest_size\r\nundo_tablespace\r\ninstance_number\r\nldap_directory_sysauth\r\nremote_login_passwordfile\r\n\r\nNAME\r\n--------------------------------------------------------------------------------\r\ndb_domain\r\nshared_servers\r\nremote_listener\r\ndb_name\r\ndb_unique_name\r\nopen_cursors\r\nstar_transformation_enabled\r\npga_aggregate_target<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"tlid-results-container results-container\">\n<div class=\"tlid-result result-dict-wrapper\">\n<div class=\"result tlid-copy-target\">\n<div class=\"result-header\">\n<div class=\"starbutton jfk-button-flat jfk-button unstarred\" tabindex=\"0\" role=\"button\" aria-label=\"Star translation\" data-tooltip=\"Star translation\" data-tooltip-align=\"t,c\">\n<div class=\"jfk-button-img\"><\/div>\n<\/div>\n<\/div>\n<div class=\"text-wrap tlid-copy-target\">\n<div class=\"result-shield-container tlid-copy-target\" tabindex=\"0\"><span class=\"tlid-translation translation\" lang=\"en\"><span title=\"\"><strong>PFILE (Parameter File):<\/strong> The Pfile parameter file is the same as Spfile in its content and role, but the pfile is kept in normal character format on the operating system, not in binary.<\/span> <span class=\"\" title=\"\">The PFile file is created with the name<strong> init &lt;ORACLE_SID&gt;.ora<\/strong> on the operating system under $ORACLE_HOME\/dbs directory.<\/span> <span class=\"\" title=\"\">PFILE is not require for database if spfile is exists.<\/span> <span class=\"\" title=\"\">Spfile file is created when the database is installed and the pfile file is not created automatically.<\/span> <span class=\"\" title=\"\">The pfile file is created from the spfile because it is sometimes easier to change a parameter at the pfile because the Pfile file is textual.<\/span> <span title=\"\">The pfile file from the spfile file is created as follows.<\/span><\/span><\/div>\n<div tabindex=\"0\"><\/div>\n<div tabindex=\"0\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<pre>[oracle@MehmetSalih ~]$ sqlplus \/ as sysdba\r\n\r\nSQL*Plus: Release 12.2.0.1.0 Production on Tue Mar 19 14:39:55 2019\r\n\r\nCopyright (c) 1982, 2016, Oracle.  All rights reserved.\r\n\r\n\r\nConnected to:\r\nOracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production\r\n\r\nSQL&gt; create pfile from spfile;\r\n\r\nFile created.\r\n\r\nSQL&gt; exit\r\nDisconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production\r\n[oracle@MehmetSalih ~]$\r\n[oracle@MehmetSalih ~]$\r\n[oracle@MehmetSalih ~]$ ls -l \/oracle\/product\/12.1.2\/db\/dbs\/init*\r\n-rw-r--r--. 1 oracle oinstall 3079 May 15  2015 \/oracle\/product\/12.1.2\/db\/dbs\/init.ora\r\n<strong>-rw-r--r--. 1 oracle oinstall 1549 Mar 19 14:39 \/oracle\/product\/12.1.2\/db\/dbs\/initDEVECI.ora<\/strong>\r\n[oracle@MehmetSalih ~]$<\/pre>\n<p>&nbsp;<\/p>\n<p>You can see content of pfile with linux cat command like following.<\/p>\n<pre>\r\n\r\n\r\n[oracle@MehmetSalih ~]$ cat \/oracle\/product\/12.1.2\/db\/dbs\/initDEVECI.ora\r\nDEVECIDB.__data_transfer_cache_size=0\r\nDEVECI.__data_transfer_cache_size=0\r\nDEVECIDB.__db_cache_size=2818572288\r\nDEVECI.__db_cache_size=2332033024\r\nDEVECIDB.__inmemory_ext_roarea=0\r\nDEVECI.__inmemory_ext_roarea=0\r\nDEVECIDB.__inmemory_ext_rwarea=0\r\nDEVECI.__inmemory_ext_rwarea=0\r\nDEVECIDB.__java_pool_size=16777216\r\nDEVECI.__java_pool_size=16777216\r\nDEVECIDB.__large_pool_size=33554432\r\nDEVECI.__large_pool_size=33554432\r\nDEVECIDB.__oracle_base='\/oracle\/product'#ORACLE_BASE set from environment\r\nDEVECI.__oracle_base='\/oracle\/product'#ORACLE_BASE set from environment\r\nDEVECIDB.__pga_aggregate_target=1191182336\r\nDEVECI.__pga_aggregate_target=1191182336\r\nDEVECIDB.__sga_target=3774873600\r\nDEVECI.__sga_target=3774873600\r\nDEVECIDB.__shared_io_pool_size=201326592\r\nDEVECI.__shared_io_pool_size=201326592\r\nDEVECIDB.__shared_pool_size=687865856\r\nDEVECI.__shared_pool_size=1174405120\r\nDEVECIDB.__streams_pool_size=0\r\nDEVECI.__streams_pool_size=0\r\n*.audit_file_dest='\/oracle\/product\/admin\/DEVECIDB\/adump'\r\n*.audit_trail='db'\r\n*.compatible='12.2.0'\r\n*.control_files='\/u01\/oradata\/DEVECIDB\/control01.ctl','\/oracle\/product\/fast_recovery_area\/DEVECIDB\/control02.ctl'\r\n*.db_block_size=8192\r\n*.db_name='DEVECIDB'\r\n*.db_recovery_file_dest='\/oracle\/product\/fast_recovery_area\/DEVECIDB'\r\n*.db_recovery_file_dest_size=10g\r\n*.diagnostic_dest='\/oracle\/product'\r\n*.dispatchers='(PROTOCOL=TCP) (SERVICE=DEVECIDBXDB)'\r\n*.local_listener='LISTENER_DEVECIDB'\r\n*.log_archive_format='%t_%s_%r.dbf'\r\n*.nls_language='AMERICAN'\r\n*.nls_territory='AMERICA'\r\n*.open_cursors=300\r\n*.pga_aggregate_target=1121m\r\n*.processes=300\r\n*.remote_login_passwordfile='EXCLUSIVE'\r\n*.sga_target=3600m\r\n*.undo_tablespace='UNDOTBS1'\r\n[oracle@MehmetSalih ~]$\r\n\r\n<\/pre>\n<p>As I mentioned above, one of them ( spfile or pfile ) is enough to start the Oracle instance, but if both files are present when starting the instance, Oracle is started using the spfile automatically.<\/p>\n<p>Since our Spfile file is very important, it is necessary to take backup of the spfile continuously with the full backups . In order for the Spfile file to be backed up automatically, the database must be in autobackup mode. We can do this on the RMAN tool as below.<\/p>\n<pre><\/pre>\n<pre>[oracle@MehmetSalih ~]$  rman target \/\r\n\r\nRMAN&gt; CONFIGURE CONTROLFILE AUTOBACKUP ON;\r\n\r\nusing target database control file instead of recovery catalog\r\nold RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP OFF;\r\nnew RMAN configuration parameters:\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\nnew RMAN configuration parameters are successfully stored\r\n\r\nRMAN&gt;<\/pre>\n<p>&nbsp;<\/p>\n<div class=\"tlid-results-container results-container\">\n<div class=\"tlid-result result-dict-wrapper\">\n<div class=\"result tlid-copy-target\">\n<div class=\"text-wrap tlid-copy-target\">\n<div class=\"result-shield-container tlid-copy-target\" tabindex=\"0\"><span class=\"tlid-translation translation\" lang=\"en\"><span class=\"\" title=\"\">If, as above, the backup file is automatically retrieved, a backup copy of the Spfile is copied to the path where Autobackup is set.<\/span><\/span><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<pre>[oracle@MehmetSalih ~]$ rman target \/ \r\n\r\nRMAN&gt; show all;\r\n\r\nusing target database control file instead of recovery catalog\r\nRMAN configuration parameters for database with db_unique_name DEVECI are:\r\nCONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;\r\nCONFIGURE BACKUP OPTIMIZATION ON;\r\nCONFIGURE DEFAULT DEVICE TYPE TO DISK;\r\nCONFIGURE CONTROLFILE AUTOBACKUP ON;\r\n<span style=\"color: #ff0000;\"><strong>CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '\/oracle\/recovery_area\/ctrl_%F';<\/strong><\/span>\r\nCONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default\r\nCONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default\r\nCONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1;\r\nCONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2 G;\r\nCONFIGURE MAXSETSIZE TO 4 G;\r\nCONFIGURE ENCRYPTION FOR DATABASE ON;\r\nCONFIGURE ENCRYPTION ALGORITHM 'AES128';\r\nCONFIGURE COMPRESSION ALGORITHM 'LOW' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;\r\nCONFIGURE ARCHIVELOG DELETION POLICY TO SHIPPED TO ALL STANDBY;\r\nCONFIGURE SNAPSHOT CONTROLFILE NAME TO '\/oracle\/product\/12.1.0\/db\/dbs\/snapcf_TESTDB.f';\r\n\r\nRMAN&gt;<\/pre>\n<p>&nbsp;<\/p>\n\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h5><span style=\"color: #ff0000;\">Do you want to learn Oracle Database for Beginners, then read the following articles.<\/span><\/h5>\n<p><a href=\"https:\/\/ittutorial.org\/oracle-database-19c-tutorials-for-beginners\/\">https:\/\/ittutorial.org\/oracle-database-19c-tutorials-for-beginners\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, In this article, I will explain the parameter files that are very important for Oracle database. This parameter is created when opening the Oracle instance and then we can change the contents of these parameter files either dynamically or statically.Oracle In our database there are 2 identical parameter files, which are named SPFILE and &hellip;<\/p>\n","protected":false},"author":1,"featured_media":3311,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1994],"tags":[11093,11088,11087,2628,2627,6298,11094,11095,11096,11099,6290,485,2747,11102,508,11097,6274,11089,11090,11091,11092,1031,6264,6259,6257,1120,2622,2631,2630,2624,2623,1309,2629,1338,1339,1345,1411,11104,11085,11101,11098,1515,11086,6248,11084,11100,1571,2632,2633,10029,10030,11103,2098,2625,2626],"class_list":["post-6733","post","type-post","status-publish","format-standard","has-post-thumbnail","","category-oracle","tag-cluster_database","tag-compatible","tag-control_files","tag-create-pfile-from-spfile","tag-create-spfile-from-pfile","tag-db_block_size","tag-db_create_file_dest","tag-db_create_online_log_dest_1","tag-db_create_online_log_dest_2","tag-db_domain","tag-db_name","tag-db_recovery_file_dest","tag-db_recovery_file_dest_size","tag-db_unique_name","tag-deveci","tag-instance_number","tag-ldap_directory_sysauth","tag-log_archive_dest_1","tag-log_archive_dest_2","tag-log_archive_dest_state_1","tag-log_archive_dest_state_2","tag-mehmet-salih-deveci","tag-nls_language","tag-nls_territory","tag-open_cursors","tag-oracle","tag-oracle-database-parameter-files-spfile-pfile","tag-oracle-oracle-server-parameter-file-pfie-spfile","tag-oracle-parameter-file","tag-oracle-parameter-files","tag-oracle-parameters","tag-oracle-pfile","tag-oracle-server-parameter-file","tag-oracle-spfile","tag-oracle-spfile-pfile","tag-oracle-support","tag-pfile","tag-pga_aggregate_target","tag-processes","tag-remote_listener","tag-remote_login_passwordfile","tag-salih-deveci","tag-sessions","tag-sga_target","tag-shared_io_pool_size-12c","tag-shared_servers","tag-spfile","tag-spfile-autobackup","tag-spfile-backup","tag-spfile-pfile","tag-spfile-pfile-oracle","tag-star_transformation_enabled","tag-undo_tablespace","tag-what-is-the-pfile","tag-what-is-the-spfile"],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/ittutorial.org\/wp-content\/uploads\/2013\/10\/spfile.gif","jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/comments?post=6733"}],"version-history":[{"count":7,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6733\/revisions"}],"predecessor-version":[{"id":12659,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/posts\/6733\/revisions\/12659"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media\/3311"}],"wp:attachment":[{"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/media?parent=6733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/categories?post=6733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ittutorial.org\/wp-json\/wp\/v2\/tags?post=6733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}