Shell scripting interview questions


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?
#!/bin/bash
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

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner


Oracle startup command parameter and its usage


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
normal
transactional
transactional local
immediate
abort

Free Oracle Database Articles, Tips, Jobs :

Delivered by FeedBurner

Oracle Database RMAN Defaults List


Oracle database RMAN (Recovery Manager) has some default settings. To get to know details of RMAN defaults, use show all command. Connect to target database and issue the command
$rman target /
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name onlinetutelage are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOA
D TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘C:APPUSERPRODUCT11.2.0DBHOM
E_3DATABASESNCFlr.ORA’; # default
RMAN>
The output shows that control file of the target database is used instead of recovery catalog.

Oracle database startup stages enterprise manager


Oracle database instance can be started in stages. This sequence can be viewed from Oracle Enterprise Manager Database Control 11g. Here are the sequence of steps and corresponding screen shots. I’ve logged into OEM as SYSMAN user with NORMAL Privilege (NORMAL in Drop-Down menu)
1) When database is in normal state
2) Shutdown the instance using SHUTDOWN IMMEDIATE command. This throws an error in OEM Database Control
3) Issue STARTUP command with NOMOUNT option. In Database Control Click OK.Instance status shows no mount
4) Mount the database by issuing ALTER DATABASE MOUNT; command. Click on refresh button at top right corner of database control and status changes to mounted
5) Open the database using ALTER DATABASE OPEN; command. This will show the status as open now