Oracle安装部署之dbca静默建库和删除库

时间:2022-09-19 08:38:00

dbca查看帮助:

[oracle@wen ~]$ dbca -help

1)、运行静默建库语句

[oracle@wen ~]$ dbca -silent -cloneTemplate -gdbName wen -sid wen -sysPassword oracle -systemPassword oracle -emConfiguration LOCAL -dbsnmpPassword oracle -sysmanPassword oracle -responseFile /home/oracle/dbca.rsp

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/wen/wen.log" for further details.

将wen库运行的users改名:

SQL> select username,account_status from dba_users where account_status='OPEN';

USERNAME                       ACCOUNT_STATUS

------------------------------ --------------------------------

SYSTEM                         OPEN

SYS                            OPEN

SYSMAN                         OPEN

DBSNMP                         OPEN

MGMT_VIEW                      OPEN

2)使用模板建库

模板位置:

[oracle@wen ~]$ ls $ORACLE_HOME/assistants/dbca/templates/

Data_Warehouse.dbc  example.dmp          New_Database.dbt   Seed_Database.dfb

example01.dfb       General_Purpose.dbc  Seed_Database.ctl

建库语句:

[oracle@wen ~]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbName wcw -sid wcw -responseFile NO_VALUE

[oracle@wen oradata]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc -gdbName wcw -sid wcw -emConfiguration LOCAL -dbsnmpPassword oracle -sysmanPassword oracle -responseFile NO_VALUE

静默删除数据库:

[oracle@wen oradata]$ dbca -silent -deleteDatabase -sourceDB wen

Connecting to database

4% complete

9% complete

14% complete

19% complete

23% complete

28% complete

47% complete

Updating network configuration files

48% complete

52% complete

Deleting instance and datafiles

76% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/wen.log" for further details.

克隆数据库

1、通过已有的orcl库静默方式创建一个模板出来:

[oracle@wen ~]$ dbca -silent -createCloneTemplate -sourceSID orcl -templateName chavin

Gathering information from the source database

4% complete

8% complete

13% complete

17% complete

22% complete

Backup datafiles

28% complete

88% complete

Creating template file

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/silent0.log" for further details.

2、通过上文创建模板创建数据库

[oracle@wen ~]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/chavin.dbc -gdbName chavin -sid chavin -sysPassword oracle -systemPassword oracle -responseFile NO_VALUE

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

41% complete

46% complete

51% complete

56% complete

57% complete

58% complete

61% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/chavin/chavin.log" for further details.