SRVCTL 刪除和新增資料庫服務
背景:
架構rac+單節點asm的dg
我搭建的dataguard的unique_name 我更改為了prodstd
現在的情況:
[root@racdg ~]# crsctl status resource -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE racdg STABLE ora.FRADG.dg ONLINE ONLINE racdg STABLE ora.LISTENER.lsnr ONLINE ONLINE racdg STABLE ora.MGMTDG.dg ONLINE ONLINE racdg STABLE ora.OCRDG.dg ONLINE ONLINE racdg STABLE ora.asm ONLINE ONLINE racdg Started,STABLE ora.ons OFFLINE OFFLINE racdg STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE racdg STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE racdg STABLE ora.prod.db 1 ONLINE ONLINE racdg Open,Readonly,HOME=/ u01/app/oracle/produ ct/19c/db_1,STABLE --------------------------------------------------------------------------------
雖然現在還可以使用srvctl start database -db prod啟動,但是其實已經不對了
檢視現在的配置
[oracle@racdg:/home/oracle]$srvctl config database -db prod Database unique name: prod Database name: prod Oracle home: /u01/app/oracle/product/19c/db_1 Oracle user: oracle Spfile: +DATADG/PROD/PARAMETERFILE/spfile.269.1084619231 Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Disk Groups: DATADG Services: OSDBA group: OSOPER group: Database instance: proddg
我真實的spfile,其實在我的ORACLE_HOME目錄,不在asm上
SQL> show parameter spfile; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string /u01/app/oracle/product/19c/db _1/dbs/spfileproddg.ora
spfile錯誤,unique name錯誤,但是卻不影響透過srvctl 啟動資料庫,而且啟動的prod 實際啟動的確是prodstd,所以我們測試一下,如何新增刪除。
1、刪除
[oracle@racdg:/home/oracle]$srvctl remove database -db prod PRKO-3141 : Database prod could not be removed because it was running
關閉資料庫再刪除
[oracle@racdg:/home/oracle]$srvctl stop database -db prod [oracle@racdg:/home/oracle]$srvctl remove database -db prod Remove the database prod? (y/[n]) y
2、新增
[oracle@racdg:/home/oracle]$srvctl add database -h Adds a database configuration to be managed by Oracle Restart. Usage: srvctl add database -db <db_unique_name> -oraclehome <oracle_home> [-domain <domain_name>] [-spfile <spfile>] [-pwfile <password_file_path>] [-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY | FAR_SYNC}] [-startoption <start_options>] [-stopoption <stop_options>] [-dbname <db_name>] [-instance <inst_name>] [-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY}] [-diskgroup "<diskgroup_list>"] [-verbose] -db <db_unique_name> Unique name for the database -oraclehome <path> Oracle home path -domain <domain_name> Domain for database. Must be set if database has DB_DOMAIN set. -spfile <spfile> Server parameter file path -pwfile <password_file_path> Password file path -role <role> Role of the database (PRIMARY, PHYSICAL_STANDBY, LOGICAL_STANDBY, SNAPSHOT_STANDBY, FAR_SYNC) -startoption <start_options> Startup options for the database. Examples of startup options are OPEN, MOUNT, or "READ ONLY". -stopoption <stop_options> Stop options for the database. Examples of shutdown options are NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT. -dbname <db_name> Database name (DB_NAME), if different from the unique name given by the -db option -instance <inst_name> Instance name -policy <dbpolicy> Management policy for the database (AUTOMATIC, MANUAL, NORESTART or USERONLY) -diskgroup "<diskgroup_list>" Comma separated list of disk group names -verbose Verbose output -help Print usage
按照提示新增
[oracle@racdg:/home/oracle]$srvctl add database -db prodstd -oraclehome /u01/app/oracle/product/19c/db_1 [oracle@racdg:/home/oracle]$srvctl config database -db prodstd Database unique name: prodstd Database name: Oracle home: /u01/app/oracle/product/19c/db_1 Oracle user: oracle Spfile: Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Disk Groups: Services: OSDBA group: OSOPER group: Database instance: prodstd [oracle@racdg:/home/oracle]$srvctl start database -db prodstd PRCR-1079 : Failed to start resource ora.prodstd.db CRS-5017: The resource action "ora.prodstd.db start" encountered the following error: ORA-01078: failure in processing system parameters LRM-00109: could not open parameter file '/u01/app/oracle/product/19c/db_1/dbs/initprodstd.ora' . For details refer to "(:CLSN00107:)" in "/u01/app/grid/diag/crs/racdg/crs/trace/ohasd_oraagent_grid.trc". CRS-2674: Start of 'ora.prodstd.db' on 'racdg' failed [oracle@racdg:/home/oracle]$
由上面可知道,只新增了unique_name 和 oracle_home 預設回去home目錄查詢
initprodstd.ora
的引數檔案,但是不存在,所以我們需要新增一下,具體的dbname,讓他自動去尋找home目錄下的
initproddg.ora或者spfileproddg.ora
所以參照以下
[oracle@racdg:/home/oracle]$srvctl modify database -db prodstd -h Modifies the configuration for the database. Usage: srvctl modify database -db <db_unique_name> [-dbname <db_name>] [-instance <inst_name>] [-oraclehome <oracle_home>] [-user <oracle_user>] [-domain <domain>] [-spfile <spfile>] [-pwfile <password_file_path>] [-role {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY}] [-startoption <start_options>] [-stopoption <stop_options>] [-policy {AUTOMATIC | MANUAL | NORESTART | USERONLY}] [-diskgroup "<diskgroup_list>"|-nodiskgroup] [-force] -db <db_unique_name> Unique name for the database -dbname <db_name> Database name (DB_NAME), if different from the unique name given by the -db option -instance <inst_name> Instance name -oraclehome <path> Oracle home path -user <oracle_user> Oracle user -domain <domain_name> Domain for database. Must be set if database has DB_DOMAIN set. -spfile <spfile> Server parameter file path -pwfile <password_file_path> Password file path -role <role> Role of the database (PRIMARY, PHYSICAL_STANDBY, LOGICAL_STANDBY, SNAPSHOT_STANDBY) -startoption <start_options> Startup options for the database. Examples of startup options are OPEN, MOUNT, or "READ ONLY". -stopoption <stop_options> Stop options for the database. Examples of shutdown options are NORMAL, TRANSACTIONAL, IMMEDIATE, or ABORT. -policy <dbpolicy> Management policy for the database (AUTOMATIC, MANUAL, NORESTART or USERONLY) -diskgroup "<diskgroup_list>" Comma separated list of disk group names -nodiskgroup To remove database's dependency upon disk groups -force Force the modify operation to stop database and service resources on some nodes as necessary, or to change management policy of all service to match new database management policy -verbose Verbose output -help Print usage
[oracle@racdg:/home/oracle]$srvctl modify database -db prodstd -dbname prod -instance proddg [oracle@racdg:/home/oracle]$srvctl start database -db prodstd [oracle@racdg:/home/oracle]$srvctl status database -db prodstd Database is running.
至此就透過srvctl命令啟動了資料庫,資料庫prodstd也註冊到了srvctl中了
確認
[root@racdg ~]# srvctl config database -d prodstd Database unique name: prodstd Database name: prod Oracle home: /u01/app/oracle/product/19c/db_1 Oracle user: oracle Spfile: Password file: Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Disk Groups: DATADG Services: OSDBA group: OSOPER group: Database instance: proddg [root@racdg ~]# crsctl status resource -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE racdg STABLE ora.FRADG.dg ONLINE ONLINE racdg STABLE ora.LISTENER.lsnr ONLINE ONLINE racdg STABLE ora.MGMTDG.dg ONLINE ONLINE racdg STABLE ora.OCRDG.dg ONLINE ONLINE racdg STABLE ora.asm ONLINE ONLINE racdg Started,STABLE ora.ons OFFLINE OFFLINE racdg STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE racdg STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.evmd 1 ONLINE ONLINE racdg STABLE ora.prodstd.db 1 ONLINE ONLINE racdg Open,Readonly,HOME=/ u01/app/oracle/produ ct/19c/db_1,STABLE -------------------------------------------------------------------------------- [root@racdg ~]#
這樣透過srvctl就刪除新增資料庫服務完成了
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70004783/viewspace-2854384/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 4.2.11 使用 SRVCTL 建立資料庫服務資料庫
- Windows服務的手動新增和刪除方法Windows
- srvctl add service 增加資料庫服務例子資料庫
- 【RAC】刪除RAC資料庫節點(六)——刪除Oracle叢集服務資料庫Oracle
- srvctl新增資料庫資訊報錯資料庫
- 新增叢集資料庫服務service資料庫
- SQL的資料庫操作:新增、更新、刪除、查詢SQL資料庫
- Mysql資料庫值的新增、修改、刪除及清空MySql資料庫
- Windows刪除服務Windows
- 6.12php對資料庫的刪除和批量刪除PHP資料庫
- indexedDB 刪除資料庫Index資料庫
- win10 如何刪除服務 win10刪除服務方法Win10
- 2.8.1.2 資料庫服務和效能資料庫
- 【RAC】刪除RAC資料庫節點(一)——刪除資料庫例項資料庫
- jQuery 新增和刪除classjQuery
- Solr 刪除和新增 indexSolrIndex
- 已為資料庫映象啟動資料庫,必須刪除資料庫映象才能刪除該資料庫資料庫
- 如何手工刪除oracle資料庫和軟體Oracle資料庫
- 2.11 刪除資料庫資料庫
- 如何刪除oracle資料庫Oracle資料庫
- 刪除資料庫指令碼資料庫指令碼
- 手工刪除oracle資料庫Oracle資料庫
- 手動刪除資料庫資料庫
- MongoDB 資料庫建立刪除、表(集合)建立刪除、資料增刪改查MongoDB資料庫
- 如何去掉crs服務和srvctl命令幫助
- EM資料庫重建 手動刪除資料庫資料庫
- Laravel 資料庫裡的資料刪除Laravel資料庫
- 批量刪除Oracle資料庫的資料Oracle資料庫
- 【RAC】刪除RAC資料庫節點(二)——刪除ASM資料庫ASM
- 【RAC】刪除RAC資料庫節點(五)——刪除ONS資料庫
- jquery table 的新增和刪除jQuery
- oracle 10g 如何用srvctl 新增資料庫資源到cluster中Oracle 10g資料庫
- 資料庫的選定、建立、刪除和變更資料庫
- oracle手動刪除資料庫Oracle資料庫
- [MYSQL] 資料庫建立與刪除MySql資料庫
- 手動刪除oracle資料庫Oracle資料庫
- 刪除資料庫表空間資料庫
- dbca無法刪除資料庫資料庫