ERROR: ORA-12705: Cannot access NLS data files or invalid environment specifiedSolution:
Incorrect or misspelled NLS_LANG.
For example
NLS_LANG=AMERICAN_NORWAY.UTF-8is incorrect.
However
export NLS_LANG=AMERICAN_NORWAY.UTF8is correct.
Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies. When relevant, I also write about other technologies, like Linux or PostgreSQL. Many of the posts starts with "how to" since they derive directly from my own personal experience. My goal is to provide simple examples, so that they can be easily adapted to other situations.
ERROR: ORA-12705: Cannot access NLS data files or invalid environment specifiedSolution:
NLS_LANG=AMERICAN_NORWAY.UTF-8is incorrect.
export NLS_LANG=AMERICAN_NORWAY.UTF8is correct.
instantclient-basic-linux.x64-11.2.0.4.0.zip instantclient-sqlplus-linux.x64-11.2.0.4.0.zipfrom the otn network.
mkdir /u01/oracle/product/admin/install
mv /tmp/instantclient*.zip /u01/oracle/product/admin/install
unzip instantclient-basic-linux.x64-11.2.0.4.0.zip -d /u01/oracle/product unzip instantclient-sqlplus-linux.x64-11.2.0.4.0.zip -d /u01/oracle/productThe files will be unzipped to the Directory /u01/oracle/Product/instantclient_11_2
mkdir $ORACLE_HOME/network/admin
export ORACLE_BASE=/u01/oracle export ORACLE_HOME=/u01/oracle/product/instantclient_11_2 export PATH=$PATH:$HOME/bin:$ORACLE_HOME export LD_LIBRARY_PATH=/u01/oracle/product/instantclient_11_2 export NLS_LANG=NORWEGIAN_NORWAY.UTF8 export TNS_ADMIN=$ORACLE_HOME/network/admin
sqlplus: error while loading shared libraries: libclntsh.so.11.1: cannot open shared object file: No such file or Directory
RMAN-06162: sql statement: alter system reset db_unique_name scope=spfile RMAN-08031: released channel: c1 RMAN-08031: released channel: c2 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 06/12/2014 17:40:14 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-03009: failure of sql command on clone_default channel at 06/12/2014 17:40:14 RMAN-11003: failure during parse/execution of SQL statement: alter system reset db_unique_name scope=spfile ORA-32010: ORA-32010: cannot find entry to delete in SPFILE Recovery Manager complete.
SQL> show parameter spfile NAME TYPE VALUE ---------- ----------- --------------------------------------------- spfile string /u01/oracle/product/11204/dbs/spfiletestdb01.ora
SQL> create spfile from pfile; create spfile from pfile * ERROR at line 1: ORA-32002: cannot create SPFILE already being used by the instanceWhen attempting to mount:
SQL> alter database mount; alter database mount * ERROR at line 1: ORA-01103: database name PRODDB01 in control file is not TESTDB01So the control files are incorrect, written to during the duplication, and RMAN was unfortunately interrupted before the duplication procedure completed.
SQL> alter database backup controlfile to trace as '/tmp/proddb01_cntrfile.sql';2. Transfer the file /tmp/proddb01_cntrfile.sql to the testserver
STARTUP NOMOUNT CREATE CONTROLFILE REUSE DATABASE "PRODDB01" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 200 MAXINSTANCES 8 MAXLOGHISTORY 1168 LOGFILE GROUP 1 '/u02/oradata/proddb01/redo1.log' SIZE 1000M BLOCKSIZE 512, GROUP 2 '/u02/oradata/proddb01/redo2.log' SIZE 1000M BLOCKSIZE 512, GROUP 3 '/u02/oradata/proddb01/redo3.log' SIZE 1000M BLOCKSIZE 512, GROUP 4 '/u02/oradata/proddb01/redo4.log' SIZE 1000M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/u02/oradata/proddb01/datafile/system.428.688578763', '/u02/oradata/proddb01/datafile/undotbs1.489.688574787', '/u02/oradata/proddb01/datafile/sysaux.436.688579377' . . . CHARACTER SET AL32UTF8 ;The new edited version:
STARTUP NOMOUNT CREATE CONTROLFILE REUSE SET DATABASE "TESTDB01" RESETLOGS ARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 200 MAXINSTANCES 8 MAXLOGHISTORY 1168 LOGFILE GROUP 1 '/u02/oradata/testdb01/redo1.log' SIZE 1024M BLOCKSIZE 512, GROUP 2 '/u02/oradata/testdb01/redo2.log' SIZE 1024M BLOCKSIZE 512, GROUP 3 '/u02/oradata/testdb01/redo3.log' SIZE 1024M BLOCKSIZE 512, GROUP 4 '/u02/oradata/testdb01/redo4.log' SIZE 1024M BLOCKSIZE 512 -- STANDBY LOGFILE DATAFILE '/u02/oradata/testdb01/system.428.688578763', '/u02/oradata/testdb01/undotbs1.489.688574787', '/u02/oradata/testdb01/sysaux.436.688579377', '/u02/oradata/testdb01/users.476.688577593', '/u02/oradata/testdb01/undotbs1.510.688564845', '/u02/oradata/testdb01/sl_part_data_2006.473.688577939', . . . CHARACTER SET AL32UTF8 ;5. Run the script on the newly cloned database:
SQL> sqlplus / as sysdba @proddb01_cntrfile.sql Oracle instance started Total System Global Area 5344731136 bytes Fixed Size 2255784 bytes Variable Size 1459618904 bytes Database Buffers 3875536896 bytes Redo Buffers 7319552 bytes Control file created.
SQL> alter database mount; Database mounted.7. Open the database
SQL> alter database open resetlogs; Database opened.
Dictionary check beginning Tablespace 'TEMP' #3 found in data dictionary, but not in the controlfile. Adding to controlfile. ********************************************************************* WARNING: The following temporary tablespaces contain no files. This condition can occur when a backup controlfile has been restored. It may be necessary to add files to these tablespaces. That can be done using the SQL statement: ALTER TABLESPACEADD TEMPFILE Alternatively, if these temporary tablespaces are no longer needed, then they can be dropped. Empty temporary tablespace: TEMP
SQL> alter tablespace temp add tempfile '/u02/oradata/testdb01/temp01.dbf' size 1024M reuse autoextend on next 32M maxsize unlimited;
RMAN-03002: failure of Duplicate Db command at 06/12/2014 12:28:00 RMAN-05501: aborting duplication of target database RMAN-06217: not connected to auxiliary database with a net service name
connect target sys/<password>@PRODDB01 connect rmanuser/<password>@RMANCAT connect auxiliary /use
connect target sys/<password>@PRODDB01 connect rmanuser/<password>@RMANCAT connect auxiliary sys/<password>@AUX01
run { allocate auxiliary channel t1 type sbt PARMS="BLKSIZE=1048576" maxpiecesize 32G maxopenfiles 64; allocate auxiliary channel t2 type sbt PARMS="BLKSIZE=1048576" maxpiecesize 32G maxopenfiles 64; send 'NB_ORA_POLICY=mypolicy,NB_ORA_CLIENT=myclient-bkp.mydomain,NB_ORA_SCHED=myschedule'; set until scn 5886541624244; duplicate target database to AUXDB1 logfile group 1 ('/data/oracle/u01/AUXDB1/redo01.log') size 128M, group 2 ('/data/oracle/u02/AUXDB1/redo02.log') size 128M, group 3 ('/data/oracle/u03/AUXDB1/redo03.log') size 128M; }
run { allocate auxiliary channel c1 type 'SBT_TAPE'; allocate auxiliary channel c2 type 'SBT_TAPE'; set until time "to_date('01.05.2014 18:00:00','DD.MM.YYYY HH24:MI:SS')"; duplicate target database to AUXDB1; }
db_file_name_convert=('/u02/oradata/proddb01/datafile','/u02/oradata/testdb01', '/u02/oradata/proddb01/tempfile',/u02/oradata/testdb01') log_file_name_convert=('proddb01','testdb01')When using an spfile:
alter system set db_file_name_convert='/u02/oradata/proddb01/datafile','/u02/oradata/testdb01', '/u02/oradata/proddb01/tempfile',/u02/oradata/testdb01' scope=spfile; alter system set log_file_name_convert='proddb01','testdb01' scope=spfile;
log_file_name_convert=('/u01/app/oracle/oradata/proddb01/onlinelog/','/u04/oradata/testdb01/onlinelog/') log_file_name_convert=('/u01/app/oracle/flash_recovery_area/proddb01/onlinelog/','/u04/oradata/testdb01/onlinelog/')Oracle Docs:
[root@myserver]> lsuser -a capabilities oracle oracleSet capabilities:
[root@myserver]> chuser capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE oracle [root@myserver]> lsuser -a capabilities oracle oracle capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE [root@myserver]>