Oracle DBA Linux Scripts - Lab Exercise
Oracle DBA Linux Scripts - Lab Exercise
Practice questions |
1) Write a shell script to print the following :
========================================================================================
CHOOSE ANY ONE
========================================================================================
1 . CPU information
2 . RAM information
3 . Kernel information
4 . OS version
5 . Hostname
6 . Ipaddress
7 . Exit
=========================================================================================
|
2) create a folder like /home/oracle/sfile/
Write a shell script to check the file(excel_19112020.txt) exists.
The checking should continue for every 2 secs with additional “.” suffixing the checking word.
ex. Like checking………..
If the file exists , then print “File received”.
|
3) Create a shell script to greet by given time like
$ ./greetme.sh 11
If the input is between 0 and 12 , then should print “Good Morning!!!”
if between 13 and 18 , then should print “Good Afternoon”
if between 19 and 24 , then should print “Good Night”
|
4) Write a shell script to create a database where the inputs ae passed as arguments
./CreateDB.sh {dbname} {path}
ex : ./CreateDB.sh sdbt /u01/app/oracle/oradata/sdbt
Tablespace information:
System 500m
sysaux 500m
UNDOTBS 100m
TEMP 100m
Pfile :
dbname
sga_target=800m
undo_management=AUTO
undo_tablespace=UNDOTBS
Also, Make sure, catalog and catproc were executed.
|
5) Write a shell script to monitor alertlog.
|
6) Write a shell script to do log rotate , remove logs < sysdate-2
|
7) Write a shell script to multiplex the controlfile.
./Dupcontrol.sh DBname 3
where 3 specifies no of controlfiles to be multipluxed.
|
8) Write a shell script to start the database.
|
9) Write a shell script to stop the database.
|
10) Write a shell script to start the listener, if not started.
|
11) Write a shell script to stop the listener.
|
12) Write a shell script to check for fragmentation
|
13) Write a shell script to defragment all the tables.
|
14) Write a shell script to rebuild only the unusable indexes.
|
15) Write a shell script to check the mount point limits. If exceeds 85% should send a mail to DBA@tesdbacademy.com
|
16) Write a schell script to check how many oracle databases are running in the server.
|
17) Write a shell script check the database state like NOMOUNT|MOUNT|OPEN for a given database, where database name is passed as first argument.
|
18) Write a schell script to analyze the database|schema|table where the component is passwd as argument.
ex. ./DBanalyze.sh {full} {dbname} ( will analyze the full database)
Hint : use dbms_stats.gather_database_stats;
./DBanalyze.sh {fix} {dbname} (will analyzed fixed stats )
Hint use: dbms_stats.gather_fixed_objects_stats;
./DBanalyze.sh {dict} {dbname} (will analyzed dict stats )
Hint use: dbms_stats.gather_dictionary_stats;
./DBanalyze.sh {schema} {table} {dbname} (will analyzed table stats )
Hint use: dbms_stats.gather_table_stats (‘SDBT_USER,’SAKTHIDB_TABLE’);
|
19) Write a shell script to cleanup given schema( cleaning schema meas dropping all the objects from that schema)
ex. Cleanschema.sh
|
20) Write a shell script to the below activity.This is also one type of cleaning activity.
Disable all the constraints.
Truncate the tables
Enable all the constraint.
|