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
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment