Shell scripting has emerged from automation of normal day to day operational task of system administrator, network administrator, database administrator all the way upto bigdata these days. Shell scripting interview questions are going to be integral part of DBA interview, sys admin interview, bigdata interview, netwrk admin interview, production support interview, build script creation team interview, upgrade script creation team interview and many more. Start preparing for the upcoming interview using our shell scripting interview questions and answers
1) What does $# mean in shell environment?
In a shell script mainly bash shell it is common to see if a parameter has been passed to the code. To check this $# eq command is used. Eg: if [$# eq 2]; then means is two positional parameters have been passed during script execution
2) How does a bach script start?
3) What does $0 mean in bash shell script?
In bash shell environment $0 is a special parameter that means the name of the shell if used in command prompt, name of shell script if used within shell script
4) How will you exit a bash shell?
Using command exit 1
Oracle startup command is the basic and essentially important command that starts your oracle database in-turn your DBA career internally. Lets see many different parameters that can be used with oracle startup command
startup – Normal mode that starts the oracle instance and brings up the database
startup pfile – If the parameter file is in a location that is not default location then it becomes mandatory to specify the pfile location. This file contains parameters needed to create and start an oracle instance, mount and open an oracle database
startup spfile – If the parameter file is binary file instead of normal parameter file specify spfile location
startup force – This force parameter is typically used to troubleshoot startup issues. Once force is issued the instance is shutdown with ABORT option and instance is restarted
startup quiet – Typically when an instance is started with a parameter other than quiet SGA informaiton including buffer allocated for many different parameters are displayed. If quiet parameter is used the SGA informaiton displayed will be supressed during system startup
startup restrict – During maintenance users with special privilege called as restricted session privilege can access database. To make this happen bring up database using restrict option
startup upgrade – Once an oracle home binary is upgraded in os level the next step is to upgrade a database. Ideally database would have been in earlier version. To bring it up the database should be opened in startup upgrade mode. In most cases catalog upgrade script catupgrd.sql is run after database is started in upgrade mode
startup downgrade – Used to bring up a database during downgrading of database
startup open – In most cases open parameter need not be specified as startup is equivalent to startup open command. The functionality is going to be starting of background processes, memory allocation followed by control file access based on which online redo log files and datafiles are checked for consistency and opened
startup open readonly – This option is typically used in dataguard setup. The functionality is opening database for read only reporting, backup purposes. This database is not accessible for DML transactions
startup open recover – IF the instance had crashed earlier the next time an instance is opened this needs a media recovery. For this purpose recover option with startup command comes handy
startup mount – This startup command option brings up oracle database instance including allocation of memory, starts background processes, reads control files. The database is not opened. Typically to enable archived redo log mode the database should be in archived redo log mode. Once the archiving is enabled database can be opened . For maintenance operations database is opened in mount mode
startup nomount – The background processes are started, memory is allocated but control files are not opened or read
As with startup command used for starting and normal functioning of database operations, a database can be brought own using shutdown command. Following are list of parameter options that are used with shutdown command