Friday 25 April 2014

JavaScript

JavaScript


Almost all modern HTML pages are using JavaScript.  JavaScript is the scripting language of the Web. A scripting language is a lightweight programming language. JavaScript was originally developed by Brendan Eich. JavaScript code can be inserted into any HTML page, and it can be executed by all types of web browsers.  JavaScript was formalized in the ECMAScript language standard and is primarily used as part of a web browser (client-side JavaScript). This enables programmatic access to computational objects within a host environment. It’s easy to learn.
JavaScript is an essential language that all web developers MUST learn:
  1. HTML to define the content of web pages
  2. CSS to specify the layout of web pages
  3. JavaScript to specify the behaviour of web pages.
How to enable JavaScript in browsers :
Click link to know how


Creating a dump file and restoring an Oracle database



Creating a dump file and restoring an Oracle database

This is how you create a database dump of an oracle database and restore it.

1. First you need to connect to oracle as sysdba, create a user and grant him required privileges. Command line steps for creating a user and granting privileges are as below;

C:\app\Administrator\OraHome_1\BIN>sqlplus sys as sysdba;

SQL*Plus: Release 11.1.0.7.0 - Production on Tue Jan 10 17:28:47 2012

Copyright (c) 1982, 2008, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> drop user sumit cascade;

User dropped.

SQL> Create user sumit identified by sumit account unlock;

User created.

SQL> grant create session, dba to sumit;

Grant succeeded.

SQL> grant connect to sumit;

Grant succeeded.

SQL> exit

2.  Fill in your database with data.

3. Next, lets create a database dump.
$ expdp sumit/sumit schemas=sumit dumpfile=sumit100112_1657.dmp
An oracle dump with the name sumit100112_1657.dmp will be created in the location that you ran the above command.

4. After backing-up if you need to restore the dump, do as below.
$ impdp sumit/sumit schemas=sumit dumpfile=SUMIT100112_1640.DMP


Monday 21 April 2014

ORACLE V$ Database

V$DATABASE

V$DATABASE displays information about the database from the control file.
Column Datatype Description
DBID NUMBER Database identifier calculated when the database is created and stored in all file headers
NAME VARCHAR2(9) Name of the database
CREATED DATE Creation date of the database
RESETLOGS_CHANGE# NUMBER System change number (SCN) at open resetlogs
RESETLOGS_TIME DATE Timestamp of open resetlogs
PRIOR_RESETLOGS_CHANGE# NUMBER SCN at prior resetlogs
PRIOR_RESETLOGS_TIME DATE Timestamp of prior resetlogs
LOG_MODE VARCHAR2(12) Archive log mode:
  • NOARCHIVELOG
  • ARCHIVELOG
  • MANUAL
CHECKPOINT_CHANGE# NUMBER Last SCN checkpointed
ARCHIVE_CHANGE# NUMBER Database force archiving SCN. Any redo log with a start SCN below this will be forced to archive out.
CONTROLFILE_TYPE VARCHAR2(7) Type of control file:
  • STANDBY - Indicates that the database is in standby mode
  • CLONE - Indicates a clone database
  • BACKUP | CREATED - Indicates the database is being recovered using a backup or created control file
  • CURRENT - database is available for general use
CONTROLFILE_CREATED DATE Creation date of the control file
CONTROLFILE_SEQUENCE# NUMBER Control file sequence number incremented by control file transactions
CONTROLFILE_CHANGE# NUMBER Last SCN in backup control file; null if the control file is not a backup
CONTROLFILE_TIME DATE Last timestamp in backup control file; null if the control file is not a backup
OPEN_RESETLOGS VARCHAR2(11) (NOT ALLOWED | ALLOWED | REQUIRED) Indicates whether the next database open allows or requires the resetlogs option
VERSION_TIME DATE Version time
OPEN_MODE VARCHAR2(10) Open mode information:
  • MOUNTED
  • READ WRITE
  • READ ONLY
PROTECTION_MODE VARCHAR2(20) Protection mode currently in effect for the database:
  • MAXIMUM PROTECTION - Database is running in maximized protection mode
  • MAXIMUM AVAILABILITY - Database is running in maximized availability mode
  • RESYNCHRONIZATION - Database is running in resynchronization mode
  • MAXIMUM PERFORMANCE - Database is running in maximized protection mode
  • UNPROTECTED - Database is unprotected (this normally occurs when the primary database is mounted and not open)
PROTECTION_LEVEL VARCHAR2(20) Aggregated protection mode currently in effect for the database:
  • MAXIMUM PROTECTION - Database is running in maximized protection mode
  • MAXIMUM AVAILABILITY - Database is running in maximized availability mode
  • RESYNCHRONIZATION - Database is running in resynchronization mode
  • MAXIMUM PERFORMANCE - Database is running in maximized protection mode
  • UNPROTECTED - Database is unprotected (this normally occurs when the primary database is mounted and not open)
Note: This column is an aggregation of the PROTECTION_MODE of all standby archive log destinations.
REMOTE_ARCHIVE VARCHAR2(8) Value of the REMOTE_ARCHIVE_ENABLE initialization parameter
ACTIVATION# NUMBER Number assigned to the database instantiation
SWITCHOVER# NUMBER Number assigned to the database switchover
DATABASE_ROLE VARCHAR2(16) Current role of the database:
  • LOGICAL STANDBY
  • PHYSICAL STANDBY
  • PRIMARY
ARCHIVELOG_CHANGE# NUMBER Highest NEXT_CHANGE# (from the V$ARCHIVED_LOG view) for an archive log
ARCHIVELOG_COMPRESSION VARCHAR2(8) Status of the archive log compression
SWITCHOVER_STATUS VARCHAR2(20) Indicates whether switchover is allowed:
  • NOT ALLOWED - Either this is a standby database and the primary database has not been switched first or this is a primary database and there are no standby databases.
  • SESSIONS ACTIVE - Indicates that there are active SQL sessions attached to the primary or standby database that need to be disconnected before the switchover operation is permitted. Query the V$SESSION view to identify the specific processes that need to be terminated.
  • SWITCHOVER PENDING - This is a standby database and the primary database switchover request has been received but not processed.
  • SWITCHOVER LATENT - The switchover was in pending mode, but did not complete and went back to the primary database.
  • TO PRIMARY - This is a standby database and is allowed to switch over to a primary database.
  • TO STANDBY - This is a primary database and is allowed to switch over to a standby database.
  • RECOVERY NEEDED - This is a standby database that has not received the switchover request.
  • PREPARING SWITCHOVER - Either this is a primary database that is accepting redo data from a logical standby database in preparation for switch over to the logical standby database role, or it is a logical standby database sending redo data to a primary database and other standby databases in preparation for switch over to the primary database role. In the latter case, a completed dictionary has already been sent to the primary database and other standby databases.
  • PREPARING DICTIONARY - This is a logical standby database that is sending redo data to a primary database and other standby databases in the configuration in preparation for switch over to the primary database role.
  • TO LOGICAL STANDBY - This is a primary database that has received a complete dictionary from a logical standby database.
DATAGUARD_BROKER VARCHAR2(8) Indicates whether the Data Guard configuration is being managed by the broker (ENABLED) or not (DISABLED)
GUARD_STATUS VARCHAR2(7) Protects data from being changed:
  • ALL - Indicates all users other than SYS are prevented from making changes to any data in the database.
  • STANDBY - Indicates all users other than SYS are prevented from making changes to any database object being maintained by logical standby.
  • NONE - Indicates normal security for all data in the database.
SUPPLEMENTAL_LOG_DATA_MIN VARCHAR2(8) Ensures that LogMiner (and any products building on LogMiner technology) will have sufficient information to support chained rows and various storage arrangements such as cluster tables:
  • NO - None of the database-wide supplemental logging directives are enabled
  • IMPLICIT - Minimal supplemental logging is enabled because all or a combination of primary key, unique key, and foreign key supplemental logging is enabled
  • YES - Minimal supplemental logging is enabled through an ALTER DATABASE ADD SUPPLEMENTAL LOG DATA statement
See Also: Oracle Database SQL Reference for additional information about the ALTER DATABASE ADD SUPPLEMENTAL LOG DATA statement
SUPPLEMENTAL_LOG_DATA_PK VARCHAR2(3) For all tables with a primary key, indicates whether all columns of the primary key are placed into the redo log whenever an update is performed (YES) or not (NO) See Also: Oracle Database SQL Reference for more information about the ALTER DATABASE ADD SUPPLEMENTAL LOG supplemental_id_key_clause statement
SUPPLEMENTAL_LOG_DATA_UI VARCHAR2(3) For all tables with a unique key, indicates whether all other columns belonging to the unique key are placed into the redo log if any of the unique key columns are modified (YES) or not (NO) See Also: Oracle Database SQL Reference for more information about the ALTER DATABASE ADD SUPPLEMENTAL LOG supplemental_id_key_clause statement
FORCE_LOGGING VARCHAR2(3) Indicates whether the database is under force logging mode (YES) or not (NO)
PLATFORM_ID NUMBER Platform identification number of the database
PLATFORM_NAME VARCHAR2(101) Platform name of the database
RECOVERY_TARGET_INCARNATION# NUMBER Incarnation number where all datafiles are recovered by the RECOVER DATABASE command
LAST_OPEN_INCARNATION# NUMBER Record number of the incarnation in V$DATABASE_INCARNATION that was last opened successfully
CURRENT_SCN NUMBER Current SCN; null if the database is not currently open. For a standby database, the current standby redo application SCN.
FLASHBACK_ON VARCHAR2(3) Possible values are as follows:
  • YES - Flashback is on
  • NO - Flashback is off
  • RESTORE POINT ONLY - Flashback is on but one can only flashback to guaranteed restore points
SUPPLEMENTAL_LOG_DATA_FK VARCHAR2(3) For all tables with a foreign key, indicates whether all other columns belonging to the foreign key are placed into the redo log if any foreign key columns are modified (YES) or not (NO) See Also: Oracle Database SQL Reference for more information about the ALTER DATABASE ADD SUPPLEMENTAL LOG supplemental_id_key_clause statement
SUPPLEMENTAL_LOG_DATA_ALL VARCHAR2(3) For all columns, indicates whether all the fixed-length maximum size columns of that row are placed into the redo log (YES) or not (NO) See Also: Oracle Database SQL Reference for more information about the ALTER DATABASE ADD SUPPLEMENTAL LOG supplemental_id_key_clause statement
DB_UNIQUE_NAME VARCHAR2(30) Unique database name
STANDBY_BECAME_PRIMARY_SCN NUMBER SCN at which a physical standby database became a primary database. This SCN is useful for converting a failed primary database into a physical standby database after a forced failover. See Also: Oracle Data Guard Concepts and Administration.
FS_FAILOVER_STATUS VARCHAR2(21) Fast-start failover status:
  • DISABLED
  • BYSTANDER
  • SYNCHRONIZED
  • UNSYNCHRONIZED
  • LOADING DICTIONARY
  • SUSPENDED
  • STALLED
  • PRIMARY UNOBSERVED
  • REINSTATE REQUIRED
  • REINSTATE IN PROGRESS
  • REINSTATE FAILED
See Also: Oracle Data Guard Broker for detailed descriptions of these values.
FS_FAILOVER_CURRENT_TARGET VARCHAR2(30) DB_UNIQUE_NAME of the standby that is the current FSFO target standby for the Data Guard configuration
FS_FAILOVER_THRESHOLD NUMBER Time in seconds that the observer will attempt to reconnect with a disconnected primary before attempting FSFO with the target standby
FS_FAILOVER_OBSERVER_PRESENT VARCHAR2(7) YES - Observer is currently connected to the local database NO - Observer is not connected to the local database
Note: This field is consistent throughout a Real Application Clusters (RAC) environment; that is, if the observer is connected to any instance in the RAC, all will show a value of YES.
FS_FAILOVER_OBSERVER_HOST VARCHAR2(512) Machine name that is currently hosting the observer process

Friday 18 April 2014

CGI or Common Gateway Interface:

CGI or Common Gateway Interface:
To understand the concept of CGI, let's see what happens when we click a hyperlink to browse a particular web page or URL.

    Your browser contacts the HTTP web server and demand for the URL ie. filename.

    Web Server will parse the URL and will look for the filename. If it finds requested file then web server sends that file back to the browser otherwise sends an error message indicating that you have requested a wrong file.

    Web browser takes response from web server and displays either the received file or error message based on the received response.

However, it is possible to set up the HTTP server in such a way that whenever a file in a certain directory is requested, that file is not sent back; instead it is executed as a program, and produced output from the program is sent back to your browser to display.

The Common Gateway Interface (CGI) is a standard protocol for enabling applications (called CGI programs or CGI scripts) to interact with Web servers and with clients. These CGI programs can be written in Python, PERL, Shell, C or C++ etc.