The following is my template file testing.dbt
. I kept it under C:\app\ORCLUSER\product\12.1.0\dbhome_1\assistants\dbca\templates
. I'm trying to create it from Oracle 12c (Enterprise) DBCA. When I select create database and choose it. It says, the template file is in invalid template file and it is not in the expected mode. Please help me with this.
Cannot run the template in .dbt extension in Oracle 12c DBCA
oracleoracle-12c
Related Solutions
Since you asked RAC, please see if you can use this non-RAC example as a starting point. For db_name != db_unique_name != sid - Non-RAC - Oracle 12.1 - Custom Database (not seed)
On the command line, set ddbname == parameter db_unique_name, and also set parameter db_name
dbca \
-silent \
-createDatabase \
-templateName wailua.dbt \
-sid wailua20 \
-gdbname wailuaq \
-initParams db_unique_name=wailuaq,db_name=wailua \
where wailua.dbt is copied from New_Database.dbt
db_name and db_unique_name are not mentioned in wailua.dbt
Note that variables SID and DB_UNIQUE_NAME expand in the template.
[oracle@waipio1 wailua20 templates]$ echo $ORACLE_SID
wailua20
[oracle@waipio1 wailua20 templates]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Wed Jun 11 00:48:22 2014
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options
SQL> show parameter db_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string wailua
SQL> show parameter db_unique_name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_unique_name string wailuaq
oratab:
wailua20:/app/oracle/product/12.1.0/db_1:N: # line added by Agent
ASM:
asmcmd ls data/WAILUAQ/
CONTROLFILE/
DATAFILE/
ONLINELOG/
PARAMETERFILE/
TEMPFILE/
spfilewailua20.ora
Full crdb.wailua.ksh dbca script: http://pastebin.com/vx3k5g3U/
dbca log: http://pastebin.com/8UQDEDZn/
Even if you manage to create a database with nls_comp=LINGUISTIC, nls_sort=BINARY_CI
(from scratch (Custom Database or manually), not seed or template) , the indexes will be still created without these settings and you have to take specify them manually.
SQL> select * from NLS_DATABASE_PARAMETERS where parameter in ('NLS_COMP', 'NLS_SORT');
PARAMETER VALUE
--------------- ---------------
NLS_COMP LINGUISTIC
NLS_SORT BINARY_CI
SQL> select * from NLS_INSTANCE_PARAMETERS where parameter in ('NLS_COMP', 'NLS_SORT');
PARAMETER VALUE
--------------- ---------------
NLS_SORT BINARY_CI
NLS_COMP LINGUISTIC
SQL> create table t1(id varchar2(1), something char(2000));
Table created.
SQL> insert into t1 select 'a', 'a' from dual connect by level <= 10000;
10000 rows created.
SQL> insert into t1 values ('b', 'b');
1 row created.
SQL> commit;
Commit complete.
SQL> create index t1_i1 on t1(id);
Index created.
SQL> exec dbms_stats.gather_table_stats(user, 'T1', cascade=>true, estimate_percent=>100, method_opt=>'for all columns size auto for columns id size 2');
PL/SQL procedure successfully completed.
SQL> select /*+ index(t1 t1_i1) */ count(*) from t1 where id = 'B';
COUNT(*)
----------
1
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 34cypvvhnwczh, child number 0
-------------------------------------
select /*+ index(t1 t1_i1) */ count(*) from t1 where id = 'B'
Plan hash value: 3724264953
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 907 (100)| |
| 1 | SORT AGGREGATE | | 1 | 2 | | |
|* 2 | TABLE ACCESS FULL| T1 | 5001 | 10002 | 907 (1)| 00:00:01 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter(NLSSORT("ID",'nls_sort=''BINARY_CI''')=HEXTORAW('6200'))
Index can not be used, hint does not help, and the estimated cardinality is just simply CEIL (NUM_ROWS / NUM_DISTINCT)
. This time with the proper index:
SQL> create index t1_i2 on t1(NLSSORT("ID",'nls_sort=''BINARY_CI'''));
Index created.
SQL> exec dbms_stats.gather_table_stats(user, 'T1', cascade=>true, estimate_percent=>100, method_opt=>'for all columns size auto for columns id size 2, SYS_NC00003$ size 2');
PL/SQL procedure successfully completed.
SQL> select count(*) from t1 where id = 'B';
COUNT(*)
----------
1
SQL> select * from table(dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 9pvkbfkycz6q4, child number 0
-------------------------------------
select count(*) from t1 where id = 'B'
Plan hash value: 3225262789
---------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
---------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 1 (100)| |
| 1 | SORT AGGREGATE | | 1 | 3 | | |
|* 2 | INDEX RANGE SCAN| T1_I2 | 1 | 3 | 1 (0)| 00:00:01 |
---------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T1"."SYS_NC00003$"=HEXTORAW('6200'))
Related Question
- Error launching sqlplus
- Oracle 12c – How to Configure SQL Developer
- Oracle 12C – Error Installing EM13 Templates
- Oracle 12c R2 – Creating User with Default Collation binary_ci Fails
- Linux – Can not install oracle apex on GNU/Linux (db 12c)
- Oracle 11gR2 Enterprise manager problem
- Oracle 12c – Understanding Alert Log Errors
Best Answer
For anyone facing the same problem: the reason of the error "The template data is not in the expected format" may be different interpretation of negative values between the different versions of DBCA.
Deletion of the following tags with negative values in the Testing.dbt attached by OP does the trick: