Tuesday, December 21, 2010

CHANGE PASSWORD IN MYSQL

How to change root password in mysql

Each user has the right to change his or her own password, or that of someone else,

by using the SET PASSWORD statement.

SYNTAX:

::=

SET PASSWORD [ FOR ]

= PASSWORD( )

::=

Example1:

set password for 'root'@'localhost'=passworf('new password')

example1:

Example 28.5: Change the password of SIVAGANESH to SIVAGANESH1.

SET PASSWORD FOR 'SIVAGANESH'= PASSWORD('SIVAGANESH1')

Explanation: In this statement, we assume that SIVAGANESH enters this statement himself.

If SIVAGANESH wants to change the password of another user, he needs to specify the

name of that user.




Example 28.6: Change the password of ROB to ROBSEC.

SET PASSWORD FOR ROB = PASSWORD('ROBSEC')

The below fig shows change root password in mysql command prompt

Monday, December 20, 2010

STANDBY DATABASE CREATION

                       Standby database are very critical for disaster recovery. This article takes you step by step to setup Oracle Standby Database.

 1 - Data Guard Operational Prerequisites
 2 - Preparing Primary Database for Standby Database creation
 3 - Identify the primary database Data-files
 4 - Make a copy of Primary Database
 5 - Restart the Primary Database
 6 - Create Control file for Standby Database
 7 - Create pfile from for standby database from the primary database
 8 - Set initialization parameters on physical standby database
 9 - Create a Window service
10 - Configure listeners & tnsnames for standby and primary databases
11 - Start Physical standby database
12 - Enabling archiving to Physical Standby Database
13 - Initiate Log apply services
14 - Verifying the Standby Database

15 - Annexure

1 - Data Guard Operational Prerequisites

· Same Oracle software release must be used for both primary and standby databases. The operating system running on primary and standby locations must be same, but operating system release may not need to be same.
· The Primary Database must run in ARCHIVELOG mode.
· The hardware and Operating system architecture on primary and standby location must be same.
· Each primary and standby database must have its own control file.


· If primary and standby databases are placed on the same system, initialization parameters must be adjusted correctly.
· Primary database must be FORCE LOGGING mode.


2 - Preparing Primary Database for Standby Database creation

· Ensure the primary database in ARCHIVELOG mode
      Ensure the primary database in ARCHIVELOG mode using following command.
      SQL> archive log list
      Note: If the primary database is not in ARCHIVELOG mode then make it      enable.
· Enable database in FORCE LOGGING mode
           SQL> alter database force logging;
           Database altered.

3 - Identify the primary database Data-files
  SQL> select name from v$datafile;
            NAME  
        --------------------------------------------------------------------------------
C:\ORACLE\ORADATA\ORCLC\SYSTEM01.DBF
C:\ORACLE\ORADATA\ORCLC\UNDOTBS01.DBF
C:\ORACLE\ORADATA\ORCLC\CWMLITE01.DBF
C:\ORACLE\ORADATA\ORCLC\DRSYS01.DBF
C:\ORACLE\ORADATA\ORCLC\EXAMPLE01.DBF
C:\ORACLE\ORADATA\ORCLC\INDX01.DBF
C:\ORACLE\ORADATA\ORCLC\ODM01.DBF
C:\ORACLE\ORADATA\ORCLC\TOOLS01.DBF
8 rows selected.


4 - Make a copy of Primary Database
Make a closed backup copy of primary database by performing following steps:
· Shutdown the Primary Database
      SQL> shutdown immediate;

· Copy the Datafiles to standby location
Copy the redo log files and Datafiles identified in section 3 to standby  location.
Note: Primary Database must be shutdown while copying the files.
5 - Restart the Primary Database
Execute following command to restart the Primary Database.
SQL> startup;
6 - Create Control file for Standby Database
Issue the following command on primary database to create control file for the standby database.
SQL> ALTER DATABASE CREATE STANDBY CONTROLFILE AS
   'D:\oracle\oradata\stby\control_sb01.ctl';
Database altered.
The filename for newly created standby control file must be different of current control file of the primary database. Also control file for standby database must be created after the last timestamp for the backup Datafiles.
7 - Create pfile from for standby database from the primary database
Create pfile from the server parameter file of the primary database; this pfile can be    copied to standby location and modified.
SQL> CREATE PFILE='C:\oracle\ora92\database\initstby.ora' from spfile;
File created.

8 - Set initialization parameters on physical standby database
Although most of the initialization parameter settings in the text initialization parameter file that you copied from the primary system are also appropriate for the physical standby database, some modifications need to be made. Edit created pfile from primary database.
db_name - Not modified. The same name as the primary database.
compatible - Not modified. The same as the primary database, 9.2.0.0.0.
control_files - Specify the path name and filename for the standby control file.
log_archive_start - Not modified. The same as the setting for the primary database, TRUE
standby_archive_dest - Specify the location of the archived redo logs that will be received from the primary database.
db_file_name_convert - Specify the location of the primary database datafiles followed by the standby location of the datafiles. This parameter will convert the filename of the primary database datafiles to the filename of the standby datafile filenames. If the standby database is on the same system as the primary database or if the directory structure where the datafiles are located on the standby site is different from the primary site then this parameter is required.
log_file_name_convert - Specify the location of the primary database logs followed by the standby location of the logs. This parameter will convert the filename of the primary database log to the filenames of the standby log. If the standby database is on the same system as the primary database or if the directory structure where the logs are located on the standby site is different from the primary site then this parameter is required.
log_archive_dest_1 - Specify the location where the redo logs are to be archived on the standby system. (If a switchover occurs and this instance becomes the primary database, then this parameter will specify the location where the online redo logs will be archived.)
standby_file_management - Set to AUTO.
remote_archive_enable - Set to TRUE.
instance_name - If this parameter is defined, specify a different value for the standby database than the primary database when the primary and standby databases reside on the same host.
lock_name_space - Specify the standby database instance name. Use this parameter when you create the physical standby database on the same system as the primary database. Change the INSTANCE_NAME parameter to a value other than its primary database value, and set this LOCK_NAME_SPACE initialization parameter to the same value that you specified for the standby database INSTANCE_NAME initialization parameter.
Also change the values of the parameters background_dump_dest, core_dump_dest and user_dump_dest to specify location of the standby database.
(Refer Annexure for initialization parameter settings for primary and standby database.)
9 - Create a Window service
If standby database is running on windows system, then oradim utility is used to create windows service. Issue following command from the command prompt window
C:\>oradim -new -sid stby -intpwd stby -startmode manual
10 - Configure listeners & tnsnames for standby and primary databases

Configure listeners in listeners.ora as follows
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
      )
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521))
      )
    )
  )



SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\oracle\ora92)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = Orcl)
      (ORACLE_HOME = D:\oracle\ora92)
      (SID_NAME = Orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = stby)
      (ORACLE_HOME = D:\oracle\ora92)
      (SID_NAME = stby)
    )
  )
Restart the listeners using LSNRCTL utility.
% lsnrctl stop
% lsnrctl start
Also make an entry into tnsnames.ora for standby database.
stby =
  (DESCRIPTION =
    (ADDRESS_LIST =
    


(ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = stby)
    )
  )
11 - Start Physical standby database

Start up the stand by database using following commands
C:\>set oracle_sid=stby
C:\>sqlplus /nolog
SQL*Plus: Release 9.2.0.1.0 - Production on Mon Apr 25 17:13:26 2005
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup pfile='C:\oracle\ora92\database\initstby.ora' nomount;
ORACLE instance started.
Total System Global Area  135338868 bytes
Fixed Size                   453492 bytes
Variable Size             109051904 bytes
Database Buffers           25165824 bytes
Redo Buffers                 667648 bytes
SQL> alter database mount standby database;
Database altered

12 - Enabling archiving to Physical Standby Database

To configure archive logging from the primary database to the standby site the LOG_ARCHIVE_DEST_n and LOG_ARCHIVE_DEST_STATE_n parameters must be defined.
Issue following commands from primary database session:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=stby' SCOPE=BOTH;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE SCOPE=BOTH;
System altered.
13 - Initiate Log apply services
The example includes the DISCONNECT FROM SESSION option so that log apply services run in a background session.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> alter database open read only;
alter database open read only
*
ERROR at line 1:
ORA-01154: database busy. Open, close, mount, and dismount not allowed now
SQL> recover managed standby database cancel;
Media recovery complete. Now go to primary database prompt
SQL> alter system switch logfile;
Go to stand by database prompt
SQL> alter database open read only;
Database altered.

14 - Verifying the Standby Database

On standby database query the V$ARCHIVED_LOG view to verify that redo log received.
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
  2>  FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIME         NEXT_TIME
-------------- ------------------- ----------------------
         14 25-APR-05 16:50:34 25-APR-02 16:50:42
         15 25-APR-05 16:50:42 25-APR-02 16:50:47
         16 25-APR-05 16:50:47 25-APR-02 16:51:52

Archive the current log on the primary database using following statement.
SQL> ALTER SYSTEM ARCHIVE LOG CURRENT;
On standby database query the V$ARCHIVED_LOG view
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME
  2>  FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
SEQUENCE# FIRST_TIME         NEXT_TIME
-------------- ------------------- ----------------------
         14 25-APR-05 16:50:34 25-APR-02 16:50:42
         15 25-APR-05 16:50:42 25-APR-02 16:50:47
         16 25-APR-05 16:50:47 25-APR-02 16:51:52
         17 25-APR-05 16:51:52 25-APR-02 17:34:00
Now connect scott/tiger@orclc on primary database and create table or insert row in any table.
Now connect as sys on primary database and execute following SQL statement
SQL> alter system switch logfile;

On standby database execute following SQL statements
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> alter database open read only;
Database altered.
And check whether the changes applied on the standby database or not.
15 - Annexure

15.1 Parameter file for Primary Database
*.aq_tm_processes=1
*.background_dump_dest='D:\oracle\admin\Orclc\bdump'
*.compatible='9.2.0.0.0'
*.control_files='C:\oracle\oradata\Orclc\CONTROL01.CTL',
'C:\oracle\oradata\Orclc\CONTROL02.CTL','C:\oracle\oradata\Orclc\CONTROL03.CTL'
*.core_dump_dest='D:\oracle\admin\Orclc\cdump'
*.db_block_size=8192
*.db_cache_size=25165824
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='Orclc'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OrclcXDB)'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='Orclc'

*.java_pool_size=33554432
*.job_queue_processes=10
*.large_pool_size=8388608
*.log_archive_dest_1='LOCATION=C:\oracle\ora92\database\archive\ORCLC mANDATORY'
*.log_archive_dest_2='SERVICE=stby'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_start=true
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_login_passwordfile='EXCLUSIVE'
*.shared_pool_size=50331648
*.sort_area_size=524288
*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='D:\oracle\admin\Orclc\udump'

15.2 Parameter file for Standby Database

*.aq_tm_processes=1
*.background_dump_dest='D:\oracle\admin\stby\bdump'

*.compatible='9.2.0.0.0'
*.control_files='D:\oracle\oradata\stby\CONTROL_SB01.CTL'
*.core_dump_dest='D:\oracle\admin\stby\cdump'
*.db_block_size=8192
*.db_cache_size=25165824
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='Orclc'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=OrclcXDB)'
*.fast_start_mttr_target=300
*.hash_join_enabled=TRUE
*.instance_name='stby'
*.java_pool_size=33554432
*.job_queue_processes=10
*.large_pool_size=8388608
*.log_archive_dest_1='LOCATION=D:\oracle\admin\stby\archive'
*.log_archive_dest_state_1=enable
*.log_archive_start=true
*.open_cursors=300
*.pga_aggregate_target=25165824
*.processes=150
*.query_rewrite_enabled='FALSE'
*.remote_login_passwordfile='NONE'
*.shared_pool_size=50331648
*.sort_area_size=524288

*.star_transformation_enabled='FALSE'
*.timed_statistics=TRUE
*.undo_management='AUTO'
*.undo_retention=10800
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='D:\oracle\admin\stby\udump'
*.standby_archive_dest='C:\oracle\ora92\database\archive\ORCLC'
*.db_file_name_convert='C:\oracle\oradata\Orclc','D:\oracle\oradata\stby'
*.log_file_name_convert='C:\oracle\oradata\Orclc','D:\oracle\oradata\stby'
*.standby_file_management=AUTO
*.remote_archive_enable=TRUE
*.lock_name_space=stby

SAMPLE DATABASE STRUCTURE IN ORACLE

THIS IS SAMPLE DATABASE STRUCTURE IN ORACLE



CREATE TABLE IMAGETABLE.ASDF ( 
CARDNUM       VARCHAR2(255) NULL,
NUMBER         VARCHAR2(22) NULL,
ENNAME         NCHAR(250) NULL,
NAME         VARCHAR2(100) NOT NULL,
NAME NCHAR(200) NULL 
)
GO
CREATE TABLE IMAGETABLE.EMPLO_RESULTS ( 
ORIGINAL_ID     VARCHAR2(255) NULL,
ORIGINAL_MEMBERID       VARCHAR2(20) NULL,
VIEW_STATUS             NUMBER(38,0) NOT NULL,
EMPLO_STATUS             NUMBER(38,0) NOT NULL,
CLOSE_TIME               TIMESTAMP(6) NULL,
PHOTO_STATUS             NUMBER(38,0) NULL,
PERSDETAILSTATUS       NUMBER(38,0) NULL,
ADDRSTATUS             NUMBER(38,0) NULL,
BOARD_STATUS             NUMBER(38,0) NULL,
MEMBER_STATUS           NUMBER(38,0) NULL,
REMARKS                 VARCHAR2(200) NULL,
TOTMEMBERINPHOTO_DUP   NUMBER(38,0) NULL,
DUP_TOTMEMBERMATCH       NUMBER(38,0) NULL,
MATCHED_CONDITIONS       VARCHAR2(50) NULL,
USER_CODE             VARCHAR2(20) NULL,
EMPLO_STATUS           NUMBER(38,0) NOT NULL,
OPEN_TIME             TIMESTAMP(6) NULL,
CLOSE_TIME             TIMESTAMP(6) NULL,
PERSDETAILSTATUS     NUMBER(38,0) NULL,
REMARKS               VARCHAR2(200) NULL,
MATCHED_CONDITIONS     VARCHAR2(50) NULL,
EMPLOID                 NUMBER(38,0) NOT NULL,
SNO                     NUMBER NULL,
ORG_ENR_URN             VARCHAR2(25) NULL,
DUP_ENR_URN             VARCHAR2(25) NULL,
RECORD_STATUS           DATE NULL,
)
GO
CREATE TABLE IMAGETABLE.LOGIN ( 
SNO       NUMBER(38,0) NULL,
USERNAME VARCHAR2(50) NULL,
PASSWORD VARCHAR2(200) NULL,
NAME     VARCHAR2(50) NULL,
USERTYPE VARCHAR2(30) NULL,
CODE NUMBER(38,0) NULL 
)
GO
CREATE TABLE IMAGETABLE.LOGIN_LOG ( 
SNO       NUMBER(38,0) NULL,
USERCODE NUMBER(38,0) NULL,
LOGINTYPE VARCHAR2(10) NULL,
TIME     TIMESTAMP(6) NULL 
)
GO
CREATE TABLE IMAGETABLE.MIGID ( 
ID VARCHAR2(255) NULL 
)
GO
CREATE TABLE IMAGETABLE.BLOCK ( 
TALUK_CODE   FLOAT NOT NULL,
DISTRICT_CODE FLOAT NULL,
TALUK_NAME   NVARCHAR2(250) NULL,
TALUK_ENAME   VARCHAR2(30) NULL 
)
GO
CREATE TABLE IMAGETABLE.DISTRICT ( 
DISTRICT_CODE FLOAT NOT NULL,
DIST_NAME     VARCHAR2(30) NULL,
DIST_TNAME   NCHAR(75) NULL 
)
GO
CREATE TABLE IMAGETABLE.TABLE1 ( 
ORG VARCHAR2(20) NOT NULL,
DUP VARCHAR2(20) NULL,
MIG VARCHAR2(20) NULL 
)
GO
CREATE TABLE IMAGETABLE.DEPEND ( 
SNO             NUMBER(10,0) NOT NULL,
MEMBERID         NUMBER(10,0) NOT NULL,
APPLICATIONNO   VARCHAR2(50) NULL,
NAME   NCHAR(200) NULL,
RELATIONSHIPCODE VARCHAR2(5) NULL,
AGE             NUMBER(3,0) NULL,
GENDER           VARCHAR2(10) NULL,
ID     VARCHAR2(100) NOT NULL 
)
GO
CREATE TABLE IMAGETABLE.ENROL ( 
SERIALNO           VARCHAR2(10) NOT NULL,
APPLICANTNAMELOCAL NCHAR(250) NULL,
FATHERNAME         NCHAR(200) NULL,
DOORNO             VARCHAR2(200) NULL,
ADDRESS       NCLOB NULL,
WARDCODE           VARCHAR2(10) NULL,
OLDDOORNO         NCHAR(150) NULL,
CARDNUMBER         VARCHAR2(25) NULL,
ACTIVESTATUS       NUMBER(10,0) NULL,
BOARD             NCHAR(25) NULL,
MEMBERID           VARCHAR2(15) NULL,
ENROLLED           CHAR(10) NULL,
ID       VARCHAR2(100) NOT NULL,
MIGRATIONTIME     DATE NULL,
POVID             VARCHAR2(13) NULL,
)
GO
CREATE TABLE IMAGETABLE.TRANSACTIONS ( 
TRANSACTION_ID   NUMBER NOT NULL,
TRANSACTION_DATE DATE NOT NULL,
TRANSACTION_TYPE NUMBER NOT NULL 
)
GO
CREATE TABLE IMAGETABLE.PHOTO ( 
URN                 VARCHAR2(70) NOT NULL,
FAMILYPHOTOPATHGRAPH    BLOB NULL,
HEADPHOTO   VARCHAR2(300) NULL,
FAMILYPHOTOPATH VARCHAR2(300) NULL,
ID         VARCHAR2(255) NOT NULL 
)
GO
CREATE TABLE IMAGETABLE.V_URN ( 
CARDNUM       VARCHAR2(255) NULL,
ENNAME         NCHAR(250) NULL,
MIGID         VARCHAR2(100) NOT NULL,
NAME NCHAR(200) NULL,
ROWNO         NUMBER NULL 
)
GO

Saturday, December 18, 2010

COPYING TABLE ROWS INTO A DATA FILE

COPYING TABLE ROWS INTO A DATA FILE (WITH MIXED-MODE AUTHENTICATION)

if we using mixed-mode authentication, wemust use the -U switch to specify your login ID. Also, unless you are connecting to the default instance of SQL Server on the local computer, use the -S switch to specify the system name and, optionally, an instance name.

Syntax:

  bcp AdventureWorks.Sales.Currency out Currency.dat -c -U login_id server_name\instance_name

example

bcp AdventureWorks.Sales.Currency out Currency.dat -c -U sa -P nagercoil -S localhost\sqlexpress


sa-->loginid

nagercoil---> password

localhost ---->server_name

sqlexpress---->instance_name




the below figure shows copies data between an instance of Microsoft SQL Server 2005 and a data file in a user-specified format(dat or txt or any other user defined format)


Bulk Copy Program in Sql server 2005

BCP MEANS BULK COPY PROGRAM.
The bcp utility bulk copies data between an instance of Microsoft SQL Server 2005 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into Microsoft  SQL Server tables or to export data out of tables into data files.

SYNTAX FOR BCP

bcp databasename.schemaname.tablename out filename -T -c

or

bcp databasename.schemaname.tablename out "path" -T -c

T means trusted connection

bcp AdventureWorks.Sales.Currency out "Currency Types.dat" -T -c

the below fig shows the bcp command



The output file is shown below

SQL functions

SELECT ASCII('123')--GET THE ASCII CORRESPONDANCE OF THE GIVEN STRING
SELECT MAX(CAST(number AS BIGINT)) FROM spt_values 
SELECT MIN(CAST(number AS BIGINT)) FROM spt_values 
SELECT AVG(CAST(number AS BIGINT)) FROM spt_values 
SELECT SUM(CAST(number AS BIGINT)) FROM spt_values 
SELECT CEILING(3.8)
SELECT FLOOR(3.8)
SELECT ROUND(3.84554,2)
SELECT CHAR(65)--GET THE CHARECTER CORRESPONDANCE OF THE ASCII CHAR
SELECT CHARINDEX('E','KALETH') --DEFAULT FIRST OCCURENCE
SELECT CHARINDEX('E','EELETH',3)  --FIRST OCCURENCE AFTER THE  LOCATION MENTIONED
SELECT COUNT(number) FROM spt_values 
SELECT GETDATE()
SELECT DATEADD(DD,5,GETDATE())
SELECT DATEDIFF(DD,GETDATE(),DATEADD(DD,5,GETDATE()))
SELECT DAY(GETDATE())
SELECT MONTH(GETDATE())
SELECT YEAR(GETDATE())
SELECT ISNULL(NULL,2)
SELECT LEFT('HAI',2)--'HA'
SELECT RIGHT('HAI',2)--'AI'
SELECT LEN(' KALETH')--7
SELECT LOWER('KaLETH')
SELECT UPPER('KaLETH')
SELECT LEN(LTRIM(' KaLETH  '))
SELECT LEN(RTRIM('   KaLETH '))
SELECT PATINDEX('%XX%','JXFDxxJDSKXXAJ')
SELECT REPLACE('KAA  LETH',' ','ME')--KAAMEMELETH
SELECT REPLICATE('KALETH',2)--KALETHKALETH
SELECT SOUNDEX('KALETH')--A430
SELECT SPACE(50)+'KALETH' +SPACE(50) +'B'
SELECT STUFF('KALETH',5,1,'ALI')
SELECT SUBSTRING('KALETH',1,5)
SELECT ABS(10)
SELECT ACOS(0.9)
SELECT ASIN(0.1)
SELECT ATAN(0.9)
SELECT COS(0.9)
SELECT SIN(0.1)
SELECT TAN(0.9)
SELECT ATN2(1,1)
SELECT CONVERT(VARCHAR(50),GETDATE(),100) as  a_100
SELECT CONVERT(VARCHAR(50),GETDATE(),101) as  a_101
SELECT CONVERT(VARCHAR(50),GETDATE(),102) as  a_102
SELECT CONVERT(VARCHAR(50),GETDATE(),103) as  a_103
SELECT CONVERT(VARCHAR(50),GETDATE(),104) as  a_104
SELECT CONVERT(VARCHAR(50),GETDATE(),105) as  a_105
SELECT CONVERT(VARCHAR(50),GETDATE(),106) as  a_106
SELECT CONVERT(VARCHAR(50),GETDATE(),107) as  a_107
SELECT CONVERT(VARCHAR(50),GETDATE(),108) as  a_108
SELECT CONVERT(VARCHAR(50),GETDATE(),109) as  a_109
SELECT CONVERT(VARCHAR(50),GETDATE(),110) as  a_110
SELECT CONVERT(VARCHAR(50),GETDATE(),111) as  a_111
SELECT EXP(0)
SELECT LOG(2)
SELECT LOG10(10)
SELECT POWER(2,3)
SELECT SIGN(-134540)
SELECT SIGN(34540)
SELECT SQRT(4)
SELECT @@ROWCOUNT
SELECT @@ERROR

Flashback technology in Oracle



Flashback technology


Flashback provides a set of features to recover data back.This technology provides analyze and repair human errors.

WE CAN ROLLBACK THE DROPPED TABLES IN ORACLE.
THE SYNTAX IS

flashback table username.tablename(dropped tablename) to before drop

example
flashback table hcls.employee to before drop

hcls ------> connection name
employee  ------------> dropped table name

Flashback technology in  Oracle



REVOVER THE DROPPED TABLE WITH ANOTHERNAME(RENAME THE DROPPED TABLE)

SYNTAX:


flashback table username.tablename(dropped tablename) to before drop rename to tablename(new table name or old tablename


flashback table "UIDAII"."TAMILNS" to before drop rename to NAGERC


UIDAII  -------> CONNECTION NAME
TAMILNS ------->DROPPED TABLE NAME