In previous post, you have seen the PSM utility installation and using PSM utility, In this post you will learn how to use CLI to effectively manage the databases using commands.
#Create Database using Json file
C:\Users\gandhi\Desktop>psm dbcs create-service -c 18cdatabase.json
Job ID : 1986734
# Check the Service aka database config
C:\Users\gandhi\Desktop>psm dbcs service -s db18c-se-si
Service: db18c-se-si
Status: In Progress
Version: 18.0.0.0
Edition: SE
Shape: oc3
Connect String: N/A
Backup Destination: NONE
Cloud Storage Container: N/A
PDB Name: pdb01
Created On: 2018-03-15T03:37:45.884+0000
# Check the Database Health
C:\Users\gandhi\Desktop>psm dbcs check-health -s db18c-se-si -of json
{
"summary":{
"status":"UP",
"status_time":"2018-03-15T03:56:47.220+00:00",
"status_message":"Running"
},
"identity_domain":"idcs-093b0defb99e433c9fb6aae82cfcb8d1",
"service_components":[
{
"component":"DB",
"vms":[
{
"vm":"db18c-se-si",
"servers":[]
}
],
"health_data":[
{
"unit":"%",
"name":"user_tablespace_usage",
"value":"2",
"type":"int",
"displayName":"Max Percentage for a User Tablespace Used"
}
]
}
],
"service_name":"db18c-se-si"
}
#Check the backups of Database,
C:\Users\gandhi\Desktop>psm dbcs view-backups -s db18c-se-si
Error: Internal Server Error. Backup / Recovery operations are not supported on this service instance.
# Stop Database , errored out with some job running, so looked at operation status as below with job id
C:\Users\gandhi\Desktop>psm dbcs stop -s db18c-se-si
Error:
{
"reason":"Resource Busy. Service idcs-093b0defb99e433c9fb6aae82cfcb8d1/db18c-se-si has active jobs. active job: 1986734 when attempting to process request: idcs-093b0defb99e433c9fb6aae82cfcb8d1/db18c-se-si: serviceType = dbaas, namespace = dbaas, operation = stop-dbaas-service"
}
# Check Operations that currently running with Job Number
C:\Users\gandhi\Desktop>psm dbcs operation-status -j 1986734
Service: db18c-se-si
Operation Type: CREATE_SERVICE
Status: RUNNING
Start Time: 2018-03-15T03:37:45.985+0000
End Time: N/AC:\Users\gandhi\Desktop>psm dbcs operation-status -j 1989704
Service: db12c-se-si
Operation Type: CREATE_SERVICE
Status: RUNNING
Start Time: 2018-03-15T04:04:10.295+0000
End Time: N/A
# Check Infrastructure activities on the database host
C:\Users\gandhi\Desktop>psm dbcs activities -s db18c-se-si
Operation Type Status Start Time End Time
CREATE_SERVICE RUNNING 2018-03-15T03:37:45.985+0000 N/A
DELETE_SERVICE SUCCEED 2018-03-14T16:00:48.245+0000 2018-03-14T16:06:35.774+0000
CREATE_SERVICE SUCCEED 2018-03-14T14:54:19.049+0000 2018-03-14T15:24:37.529+0000
# Delete Database Instance and Service
C:\Users\gandhi\Desktop>psm dbcs delete-service -s db18c-se-si
Job ID: 1989723
# Check Any patches need for databases and available
C:\Users\gandhi\Desktop>psm dbcs available-patches -s db12c-se-si
Patch ID Severity Version Release Date Requires Restart?
26710464-SE Normal 12.2.0.1.171017 2017-10-17T01:40:00.000+0000 True
# Applying Patch, Errored out I need to check why
Ex: psm dbcs patch -s ExampleInstance -p es-20831110-EE -g NODE-SAFE -h REQUIRE_STATUS_HA -t 100 -n Applying JDK80 patch
C:\Users\gandhi\Desktop>psm dbcs patch -s db12c-se-si -p 26710464-SE -of json
Error: Unsupported Media Type
# Pre check Patch
C:\Users\gandhi\Desktop>psm dbcs precheck-patch -s db12c-se-si -p 26710464-SE
Error: Unsupported Media Type
# Take snapshot of Database
C:\Users\gandhi\Desktop>psm dbcs create-snapshot -s db12c-se-si -n snapshottestest12c
Job ID : 1987024
# Scale up your database host capacity
C:\Users\gandhi\Desktop> psm dbcs scale-up -s db12c-ee -p oc4 -a 10
Specifies scaling up the shape of the service instance.
Valid values for shape-name are as follows:
•oc4 — 2 OCPUs with 15 GB RAM
•oc5 — 4 OCPUs with 30 GB RAM
•oc6 — 8 OCPUs with 60 GB RAM
•oc7 — 16 OCPUs with 120 GB RAM
•oc1m — 1 OCPU with 15 GB RAM
•oc2m — 2 OCPUs with 30 GB RAM
•oc3m — 4 OCPUs with 60 GB RAM
•oc4m — 8 OCPUs with 120 GB RAM
•oc5m — 16 OCPUs with 240 GB RAM
# Scale down your database host capacity
C:\Users\gandhi\Desktop> psm dbcs scale-down -s db12c-ee -p oc4 -a oc5-a 10
-Thanks
Suresh
Follow Me!!!