Useful Srvctl Commands

on 10:46 AM

Purpose
Commands
Starts an instance
srvctl start instance -d db_name -i inst_name
Starts all instances
srvctl start database -d db_name
Stops all instances, closes database
srvctl stop database -d db_name
Stops an instance
srvctl stop instance -d db_name -i inst_name
Starts a service
srvctl start service -d db_name -s service_name
Stops a service
srvctl stop service -d db_name -s service_name
Checks status of a service
srvctl status service -d db_name
Checks an individual instance
srvctl status instance -d db_name -i inst_name
Checks status of all instances
srvctl status database -d db_name
1. Starts nodeapps
srvctl start nodeapps -n node_name
2. What are nodeapps?
1. gsd,
2. vip,
3. listener,
4. ons
Stops gsd, vip and listener
srvctl stop nodeapps -n node_name
To start ASM on node
srvctl start asm -n node_name
To stop ASM on node
srvctl stop asm -n node_name



Generate AWR Reports

on 8:50 AM


The awrrpt.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids.

To generate an HTML or text report for a range of snapshot Ids, run the awrrpt.sql script at the SQL prompt:

SQL> @$ORACLE_HOME/rdbms/admin/awrrpt.sql

First, you need to specify whether you want an HTML or a text report.

Enter value for report_type: html


Specify the number of days for which you want to list snapshot Ids.


Enter value for num_days: 2


After the list displays, you are prompted for the beginning and ending snapshot Id for the workload repository report.


Enter value for begin_snap: 95

Enter value for end_snap: 97

Next, accept the default report name or enter a report name. The default name is accepted in the following example:


Enter value for report_name:Awr_reportprb_08072016.html


The workload repository report is generated.



awrrpt.sql

The awrrpt.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids.

awrrpti.sql

The awrrpti.sql SQL script generates an HTML or text report that displays statistics for a range of snapshot Ids on a specified database and instance.

awrsqrpt.sql

The awrsqrpt.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a range of snapshot Ids. Run this report to inspect or debug the performance of a SQL statement.

awrsqrpi.sql

The awrsqrpi.sql SQL script generates an HTML or text report that displays statistics of a particular SQL statement for a range of snapshot Ids on a specified database and instance. Run this report to inspect or debug the performance of a SQL statement on a specific database and instance.

awrddrpt.sql

The awrddrpt.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration settings between two selected time periods.

awrddrpi.sql

The awrddrpi.sql SQL script generates an HTML or text report that compares detailed performance attributes and configuration settings between two selected time periods on a specific database and instance.

CronTab

on 8:08 AM

Cron is the system process which will automatically perform tasks for you according to a set schedule. The schedule is called the Crontab.




  • crontab -e to edit crontab file
  • crontab -l  to display crontab file 
  • crontab -r to remove crontab file
  • crontab -v to display the last time you edited your crontab file.
  • crontab -u used in conjunction with other options, this option allows you to modify or view the crontab file of user, when available, only administrator can use this option.

  • @yearly -> This will execute the system annual maintenance using annual-maintenance shell script at 00:00 on Jan 1st for every year.
  • @monthly -> This will execute the shell script tape-backup at 00:00 on 1st of every month.
  • @daily -> Using the @daily cron keyword, this will do a daily log file cleanup using cleanup-logs shell scriptat 00:00 on every day.
  • @reboot -> Using the @reboot cron keyword, this will execute the specified command once after the machine got booted every time.