Oracle9iAS dcmctl Utility
dcmctl utility (
$ORACLE_HOME/dcm/bin/dcmctl) allows you to perform most of the common application server administration tasks without having to use Enterprise Manager. This can be particularly useful when you are trying to automate specific tasks such as startups, shutdowns and regular deployments. In this article I'll present the most commonly used commands:
- Process Management Commands
- Component Commands
- Application Commands
- Configuration Management Commands
- Information Retrieval Commands
Process Management Commands
These commands are self explanatory. With the exception of
shutdown they can all apply to a cluster, instance or component.
dcmctl start dcmctl start -i 903dev.server01.tshcomputing.com dcmctl start -co OC4J_Demos dcmctl stop dcmctl stop -i 903dev.server01.tshcomputing.com dcmctl stop -co OC4J_Demos dcmctl restart dcmctl restart -i 903dev.server01.tshcomputing.com dcmctl restart -co OC4J_Demos dcmctl shutdown
These commands allow you to create and remove components. A component must be created before an application can be deployed.
dcmctl createComponent -co OracleBaseCom -componentType oc4j dcmctl removeComponent -co OracleBaseCom
These commands allow you to manipulate the applications deployed within a specific component.
dcmctl deployApplication -f /u01/app/oracle/dba/OBForum.ear -a ForumApp -co OracleBaseCom dcmctl redeployApplication -f /u01/app/oracle/dba/OBForum.ear -a ForumApp -co OracleBaseCom dcmctl undeployApplication -a ForumApp -co OracleBaseCom
Configuration Management Commands
updateConfig" option is used to update the DCM repository when manual changes have been made.
Information Retrieval Commands
getstate -v" option can be used to get the current status of the application server.
dcmctl getstate -v Current State for Instance:903dev.server01.tshcomputing.com Component Type Up Status In Sync Status ================================================================================ 1 HTTP Server ohs Up True 2 OC4J_Demos oc4j Up True 3 home oc4j Up True
listComponents" option lists all the components displayed by the "
getstate -v" option but without the status information.
dcmctl listComponents HTTP Server OC4J_Demos home
listApplications" option lists the applications associated with a specific component.
dcmctl listApplications -co OC4J_Demos ojspdemos jocdemo sqljdemos jazndemos BC4JJSPDemo
getError" option returns a description of the last error encountered.
dcmctl commands can be run using the "
dcmctl shell -f redeployApp
Where the "redeployApp" script may look like this.
echo "redeploy OracleBaseCom" dcmctl redeployApplication -f /u01/app/oracle/dba/OBForum.ear -a ForumApp -co OracleBaseCom echo "restart OracleBaseCom" restart -co OracleBaseCom echo "display server status" getstate -v exit
If you run the
dcmctl utility with no parameters it lists the command usages.
dcmctl DCMCTL Command Help Examples of dcmctl commands are listed below. Commands are case insensitive. Syntax: dcmctl command option1 option2... Example: dcmctl createComponent -ct oc4j -co myComponent Options The following options can be used with any command: -v Print long version of state and error messages. -d Print stack traces for exceptions. -t Maximum time to wait for a command to complete (default 45 sec). -l Directory path for log.xml file (default current directory). -o The Oracle home path. The other options (-cl =cluster name, -i =instance name, and so on) are incorporated into the examples below with relevant commands. Process Management Commands start [[-cl myCluster] | [-i myInstance] | [-co myComponent] | [-ct componentType]] | [-admin] stop [[-cl myCluster] | [-i myInstance] | [-co myComponent] | [-ct componentType]] | [-admin] restart [[-cl myCluster] | [-i myInstance] | [-co myComponent] | [-ct componentType]] | [-admin] shutdown (stops all processes in the local instance) Cluster Commands createCluster -cl myCluster removeCluster -cl myCluster joinCluster -cl myCluster [-i myInstance] leaveCluster [-i myInstance] Instance Commands resyncInstance [-force]|[-i myInstance] destroyInstance -i myInstance saveInstance -dir directoryName restoreInstance <-dir directoryName> resetFileTransaction resetHostInformation Application Commands deployApplication -f myFile -a myApplication [-co myComponent] [-rc rootcontext (required for war deployment)] redeployApplication -f myFile -a myApplication [-co myComponent][-rc rootcontext (required for war deployment)] undeployApplication -a myApplication [-co myComponent] Component Commands createComponent -ct oc4j -co myComponent removeComponent -co myComponent Configuration Management Commands updateConfig [-ct ohs[,oc4j][,opmn]] Information Retrieval Commands listClusters listInstances [-cl myCluster] listComponents [-i myInstance] [-cl myCluster] listApplications [-cl [myCluster] | [-i myInstance] [-co myComponent]] listComponentTypes getComponentType [-i myInstance] -co myComponent getState [-i myInstance] [-cl myCluster] [-co myComponent] getReturnStatus getError adminErrorNumber (if no number is given, last exception is returned) isClusterable [-i myInstance] isCompatible -cl myCluster [-i myInstance] whichCluster [-i myInstance] whichInstance getOPMNPort addOPMNLink host1:7777[, host2:7778...] removeOPMNLink host1:7777[, host2:7778...] listOPMNlinks validateEarFile -f myFile Shell Commands shell [-f myDCMCommandFile (Starts a command line shell with a file of commands)] echo Echoes input. Enclose input with white space in " ". exit Exits the command line shell. quit Exits the command line shell. !! Repeats the previous command. @ Executes the string in the context of a different process and waits for the process to exit (valid only in shell mode).
For more information see:
Hope this helps. Regards Tim...