Oracle DB:spfile 和 init.ora 文件有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30815173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle DB : What is difference between spfile and init.ora file?
提问by malatesh
I have tried to understand through oracle docsbut could not get it properly Any body please explain. What is difference between spfile and init.ora file?
我试图通过oracle 文档理解,但无法正确理解任何机构请解释。spfile 和 init.ora 文件有什么区别?
Thanks.
谢谢。
回答by user1
init.ora
初始化程序
- init.ora or the pfile(parameter file) is a simple text file which can be updated by a standard editor like vi which contains the various initialization parameters used while starting a database instance. Here is a sample init.ora file:
- init.ora 或 pfile(参数文件)是一个简单的文本文件,可以由标准编辑器(如 vi)更新,其中包含启动数据库实例时使用的各种初始化参数。这是一个示例 init.ora 文件:
db_cache_size = 176000M
db_cache_size = 176000M
db_2k_cache_size = 2048M
db_2k_cache_size = 2048M
db_16k_cache_size = 99000M
db_16k_cache_size = 99000M
db_keep_cache_size = 600000M
db_keep_cache_size = 600000M
db_recycle_cache_size = 64000M
db_recycle_cache_size = 64000M
shared_pool_size = 14000M
shared_pool_size = 14000M
- We need to restart the database after editing the init.ora using a text editor so that the changes can come into effect.
- If we want to start a remote db we need a local pfile.
- RMAN(Recovery manager) which helps in data backup recovery process does not keep the backup of pfile or init.ora file.
- 我们需要在使用文本编辑器编辑 init.ora 后重新启动数据库,以便更改生效。
- 如果我们想启动一个远程数据库,我们需要一个本地 pfile。
- 有助于数据备份恢复过程的 RMAN(恢复管理器)不保留 pfile 或 init.ora 文件的备份。
spfile
sp文件
The Oracle spfile is a binary representation of the text based init.ora file or pfile( parameter file) which contains the various initialization parameters used while starting a database instance.Came into existence in and after Oracle 9i.
We do not edit this file using an editor as it is a binary file and may get corrupted and which may lead to your database instance not starting rather it is altered by using the
alter system
query. An example of editing a spfile :ALTER SYSTEM SET open_cursors=300 SCOPE=SPFILE;
The changes come into effect after running the
Alter system query
and we do not need to restart the database.We do not need a local copy in case of spfile if we need to start a remote database.
- As this file is maintained by the server the parameters are validated before they are accepted.
- RMAN keeps the backup of spfile.
By default our database uses pfile to start we can change that and create a spfile from a pfile or init.ora file by using the following query and we don't even need to restart the db.
sqlplus / as sydba; CREATE SPFILE FROM PFILE='/u01/oracle/dbs/init.ora;
Oracle spfile 是基于文本的 init.ora 文件或 pfile(参数文件)的二进制表示,其中包含启动数据库实例时使用的各种初始化参数。在 Oracle 9i 中和之后出现。
我们不会使用编辑器编辑此文件,因为它是一个二进制文件,可能会损坏,这可能会导致您的数据库实例无法启动,而是使用
alter system
查询对其进行了更改。编辑 spfile 的示例:ALTER SYSTEM SET open_cursors=300 SCOPE=SPFILE;
更改在运行后生效
Alter system query
,我们不需要重新启动数据库。如果我们需要启动远程数据库,则在 spfile 的情况下,我们不需要本地副本。
- 由于该文件由服务器维护,因此参数在被接受之前经过验证。
- RMAN 保留 spfile 的备份。
默认情况下,我们的数据库使用 pfile 启动,我们可以更改它并使用以下查询从 pfile 或 init.ora 文件创建 spfile,我们甚至不需要重新启动数据库。
sqlplus / as sydba; CREATE SPFILE FROM PFILE='/u01/oracle/dbs/init.ora;
回答by Moudiz
The difference between init.ora and spfile.
init.ora 和 spfile 的区别。
- init.ora and spfile both contains Database parameters info. With spfile you can set Oracle database settings with the ALTER SYSTEM command that is used in sqlplus to add/Modify/delete settings. However for init.ora you edit it as a text file because init.ora saved in the format of ASCII.
- init.ora info is read by oracle engine at the time of database instance . in spfile modifications can applicable without restarting oracle database.
- When an Oracle database is started, the process will always use spfile.ora, if it exists. If the spfile.ora is not found, the init.ora would be used on startup.
- init.ora 和 spfile 都包含数据库参数信息。使用 spfile,您可以使用 ALTER SYSTEM 命令设置 Oracle 数据库设置,该命令在 sqlplus 中用于添加/修改/删除设置。但是对于 init.ora,您将其编辑为文本文件,因为 init.ora 以 ASCII 格式保存。
- init.ora 信息在数据库实例时被oracle 引擎读取。在 spfile 中的修改可以在不重新启动 oracle 数据库的情况下适用。
- 当 Oracle 数据库启动时,该进程将始终使用 spfile.ora(如果存在)。如果找不到 spfile.ora,则启动时将使用 init.ora。