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.5.1.5 srvctl 新增服務
- 4.2.11 使用 SRVCTL 建立資料庫服務資料庫
- SQL的資料庫操作:新增、更新、刪除、查詢SQL資料庫
- Mysql資料庫值的新增、修改、刪除及清空MySql資料庫
- 6.12php對資料庫的刪除和批量刪除PHP資料庫
- indexedDB 刪除資料庫Index資料庫
- 2.11 刪除資料庫資料庫
- Windows刪除服務Windows
- jQuery 新增和刪除classjQuery
- win10 如何刪除服務 win10刪除服務方法Win10
- 2.8.1.2 資料庫服務和效能資料庫
- 達夢資料庫DM管理工具如何新增修改刪除資料庫欄位資料庫
- Laravel 資料庫裡的資料刪除Laravel資料庫
- 3.1.1.4 使用 SRVCTL 啟動資料庫資料庫
- 批次刪除WordPress文章和頁面的資料庫命令和從後臺直接刪除資料庫
- MongoDB資料庫中更新與刪除資料MongoDB資料庫
- MySQL 8.0 instant 新增和刪除列MySql
- windows 新增和刪除靜態路由Windows路由
- mysql-刪除和新增主鍵MySql
- jQuery為元素新增和刪除classjQuery
- JavaScript新增和刪除select下拉項JavaScript
- 刪除linux下的oracle資料庫LinuxOracle資料庫
- windows下Oracle資料庫完全刪除WindowsOracle資料庫
- indexedDB 刪除物件倉庫所有資料Index物件
- PostgreSQL:資料庫的建立與刪除SQL資料庫
- 資料庫代理服務和叢集管理資料庫
- 怎麼刪除mongodb服務項MongoDB
- 刪除資料
- SQL Server無法刪除資料庫 "xxx",因為該資料庫當前正在使用(如何刪除一個Sql Server資料庫)SQLServer資料庫
- 2.8.1 資料庫服務資料庫
- jQuery動態新增和刪除表格行jQuery
- jQuery table表格行的新增和刪除jQuery
- JavaScript動態新增和刪除div元素JavaScript
- DML(Data Manipulation Language、資料操作語言),用於新增、刪除、更新和查詢資料庫記資料庫
- PG資料庫更新刪除卡死現象資料庫
- dbca刪除資料庫時選項灰色資料庫
- oracle資料庫建立、刪除索引等操作Oracle資料庫索引
- mysql資料庫誤刪除操作說明MySql資料庫