Showing posts with label SQL Commands. Show all posts
Showing posts with label SQL Commands. Show all posts

Saturday, August 11, 2012

How to switch user in sqlplus

We can switch users in sqlplus without logging out

SQL> conn system/system
Connected.
SQL> conn / as sysdba
Connected.
SQL> conn scott/tiger
Connected.
SQL>

These are daily useable commands in SQL Commands (Oracle)

1.How to check Log Mode:
SELECT LOG_MODE FROM V$DATABASE;

2.Change Log Mode:

Alter database archivelog; (Database must be in mounted mode, database Alter command will not permanently add entries in spfile, we need to do it manually)

to open database in mount only mode startup mount

3.Open database read only

ALTER DATABASE OPEN READ ONLY;

4. Open Database in read and write mode:

ALTER DATABASE OPEN READ WRITE;
However, read-write is the default mode.

5.Start commands

1.Normal start = startup
2.Startup mount



Other various commands
V$ARCHIVED_LOG
Displays historical archived log information from the control file.
V$ARCHIVE_DEST
Describes archive destinations, and the current value, mode, and status of these destinations.
V$ARCHIVE_PROCESSES
Displays information about the state of the various archive processes for an instance.
V$BACKUP_REDOLOG
Contains information about any backups of archived logs. If you use a recovery catalog, the RC_BACKUP_REDOLOG contains similar information.
V$LOG
Displays all redo log groups for the database and indicates which need to be archived.
V$LOG_HISTORY
Contains log history information such as which logs have been archived and the SCN range for each archived log.