search
HomeDatabaseMysql TutorialORA-01506: missing or illegal database name 故障分析一例

今天在做RAC-DG实验时,碰到了不少的问题,这个问题是在操作用pifle创建spifle时出现的,由于在配置RAC-DG主库参数时,大部分人喜

今天在做RAC-DG实验时,碰到了不少的问题,这个问题是在操作用pifle创建spifle时出现的

由于在配置RAC-DG主库参数时,大部分人喜欢直接用alter system set xxx='xxx.xxx' scope=spfile;

而我由于不想一条条敲命令,所以先用主库参数创建一个pifle,然后对pfile进行修改,加上我们所需的DG配置参数,然后再把pfile写回spfile参数文件,再用spfile来启动RAC数据库

步骤如下:

1.在主库正常启动状态下执行:

SQL> create pfile='/rmanbackup/initora11dg.ora' from spfile;

File created.

2.修改生成的pfile参数文件的内容,主要添加以下内容:

#装完GI后原有参数
*.audit_file_dest='/u01/app/Oracle/admin/ora11rac/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/ora11rac/controlfile/current.260.823440203','+BACKUPDG/ora11rac/controlfile/current.256.823440203'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='ora11rac'
*.db_recovery_file_dest='+BACKUPDG'
*.db_recovery_file_dest_size=4558159872
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ora11racXDB)'
ora11rac2.instance_number=2
ora11rac1.instance_number=1
*.memory_target=838860800
*.open_cursors=300
*.processes=150
*.remote_listener='zlm-cluster-scan:1521'
*.remote_login_passwordfile='exclusive'
ora11rac2.thread=2
ora11rac1.thread=1
ora11rac2.undo_tablespace='UNDOTBS2'
ora11rac1.undo_tablespace='UNDOTBS1'

#以下为配置DG而添加的内容
*.db_unique_name='ora11rac'
*.log_archive_config='dg_config=(ora11rac,ora11dg)'
*.log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=ora11rac'
*.log_archive_dest_2='service=ora11dg valid_for=(online_logfiles,primary_role) db_unique_name=ora11dg'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_format='arc_%t_%s_%r.arc'

#为switchover或failover而设置的参数
*.fal_server=ora11dg
*.standby_file_management='auto'
*.db_file_name_convert='/u01/app/oracle/oradata/ora11dg/datafile','+DATA/ora11rac/datafile','/u01/app/oracle/oradata/ora11dg/datafile','+DATA/ora11rac/tempfile'
*.log_file_name_convert='/u01/app/oracle/oradata/ora11dg/datafile','+DATA/ora11rac/onlinelog','/u01/app/oracle/oradata/ora11dg/datafile','+BACKUPDG/ora11rac/onlinelog'

3.保存退出后,执行以下命令:

SQL> create spfile='+DATA/ora11rac/spfileora11rac.ora' from pfile;

File created.

本来以为这样就完成了我的预定目标->用pfile修改spfile,但是当我再startup启动数据库时,,报了ORA-01506的错误

SQL> startup force
ORA-01506: missing or illegal database name

这个错误,按字面理解就是丢失数据库名,就是参数中没有db_name这项内容或者配置错误。

发生这个错误是因为没有之前的创建spfile语句没有指定pfile路径所致。其实和单实例本地路径存放不同(单实例环境直接执行create spifle from pfile是不会有问题的,因为这2个文件都存放在$ORACLE_HOME/dbs路径下),如果pfile不指定路径,默认使用的只是dbs下的initora11rac1.ora去生成spfile,由于在ASM中,此文件是用来指向ASM中spfile文件的存放路径,内容只有一句“+DATA/ora11rac/spfileora11rac.ora”,知道了问题所在,那么把上面那条创建spifle的语句修改如下:

SQL> create spfile='+DATA/ora11rac/spfileora11rac.ora' from pfile='/rmanbackup/initora11rac.ora';

File created.
SQL> startup
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2232960 bytes
Variable Size            578817408 bytes
Database Buffers          251658240 bytes
Redo Buffers                2396160 bytes
Database mounted.
Database opened.
SQL> show parameter spfile


NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                              string      +DATA/ora11rac/spfileora11rac.
                                                ora
此时再用spfile启动正常,问题解决了。

总结:发现问题不要慌张,根据oracle的错误提示,去思考错误发生的原因,如果自己不能得出有效的判断,可以借助一些手段,比如google,很多ora-xxxxx错误搜索一下就能得出很多条结果,虽然产生的原因和解决的办法不尽相同,但是我想说的是,可以为你提供一种思路。很多情况下,别人可以用的方法,可以执行的命令是ok的,但是到了自己的环境,却不一定是一样的。

以上的这个问题,其实是因为自己初学,对ASM的RAC环境还不够熟悉所致,如果知道默认是去dbs使用pfile的这个规则,那么很容易就能发现问题所在,而这个也是一个经验积累的过程,碰到一个问题就解决一个,假以时日,你就会成为truble shooting的高手了。

推荐阅读:

Data Guard 配置 Standby Redo Log

RMAN duplicate for Standby失败解决过程

Data Gurad物理备份方式下以READ ONLY/WRITE模式打开物理Standby

RAC primary+Single Standby DG配置实践

Oracle Standby 策略 PPT

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What are stored procedures in MySQL?What are stored procedures in MySQL?May 01, 2025 am 12:27 AM

Stored procedures are precompiled SQL statements in MySQL for improving performance and simplifying complex operations. 1. Improve performance: After the first compilation, subsequent calls do not need to be recompiled. 2. Improve security: Restrict data table access through permission control. 3. Simplify complex operations: combine multiple SQL statements to simplify application layer logic.

How does query caching work in MySQL?How does query caching work in MySQL?May 01, 2025 am 12:26 AM

The working principle of MySQL query cache is to store the results of SELECT query, and when the same query is executed again, the cached results are directly returned. 1) Query cache improves database reading performance and finds cached results through hash values. 2) Simple configuration, set query_cache_type and query_cache_size in MySQL configuration file. 3) Use the SQL_NO_CACHE keyword to disable the cache of specific queries. 4) In high-frequency update environments, query cache may cause performance bottlenecks and needs to be optimized for use through monitoring and adjustment of parameters.

What are the advantages of using MySQL over other relational databases?What are the advantages of using MySQL over other relational databases?May 01, 2025 am 12:18 AM

The reasons why MySQL is widely used in various projects include: 1. High performance and scalability, supporting multiple storage engines; 2. Easy to use and maintain, simple configuration and rich tools; 3. Rich ecosystem, attracting a large number of community and third-party tool support; 4. Cross-platform support, suitable for multiple operating systems.

How do you handle database upgrades in MySQL?How do you handle database upgrades in MySQL?Apr 30, 2025 am 12:28 AM

The steps for upgrading MySQL database include: 1. Backup the database, 2. Stop the current MySQL service, 3. Install the new version of MySQL, 4. Start the new version of MySQL service, 5. Recover the database. Compatibility issues are required during the upgrade process, and advanced tools such as PerconaToolkit can be used for testing and optimization.

What are the different backup strategies you can use for MySQL?What are the different backup strategies you can use for MySQL?Apr 30, 2025 am 12:28 AM

MySQL backup policies include logical backup, physical backup, incremental backup, replication-based backup, and cloud backup. 1. Logical backup uses mysqldump to export database structure and data, which is suitable for small databases and version migrations. 2. Physical backups are fast and comprehensive by copying data files, but require database consistency. 3. Incremental backup uses binary logging to record changes, which is suitable for large databases. 4. Replication-based backup reduces the impact on the production system by backing up from the server. 5. Cloud backups such as AmazonRDS provide automation solutions, but costs and control need to be considered. When selecting a policy, database size, downtime tolerance, recovery time, and recovery point goals should be considered.

What is MySQL clustering?What is MySQL clustering?Apr 30, 2025 am 12:28 AM

MySQLclusteringenhancesdatabaserobustnessandscalabilitybydistributingdataacrossmultiplenodes.ItusestheNDBenginefordatareplicationandfaulttolerance,ensuringhighavailability.Setupinvolvesconfiguringmanagement,data,andSQLnodes,withcarefulmonitoringandpe

How do you optimize database schema design for performance in MySQL?How do you optimize database schema design for performance in MySQL?Apr 30, 2025 am 12:27 AM

Optimizing database schema design in MySQL can improve performance through the following steps: 1. Index optimization: Create indexes on common query columns, balancing the overhead of query and inserting updates. 2. Table structure optimization: Reduce data redundancy through normalization or anti-normalization and improve access efficiency. 3. Data type selection: Use appropriate data types, such as INT instead of VARCHAR, to reduce storage space. 4. Partitioning and sub-table: For large data volumes, use partitioning and sub-table to disperse data to improve query and maintenance efficiency.

How can you optimize MySQL performance?How can you optimize MySQL performance?Apr 30, 2025 am 12:26 AM

TooptimizeMySQLperformance,followthesesteps:1)Implementproperindexingtospeedupqueries,2)UseEXPLAINtoanalyzeandoptimizequeryperformance,3)Adjustserverconfigurationsettingslikeinnodb_buffer_pool_sizeandmax_connections,4)Usepartitioningforlargetablestoi

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft