Posts

Showing posts from May, 2012

Searching with a particular word in view defination

Searching with a particular word in view defination create table dba_views_with_clob as (select owner,view_name,to_lob(text) text from dba_views); select * from dba_views_with_clob where upper(text) like '%TBLCDR%' and owner not like 'REPORT';

Direct Data Load from external file to SQL Server Table and Vice Versa

## Using OpenRowSet we can load data from an xl file to a table insert into dbo.Customers_xl SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',   'Excel 8.0;IMEX=1;HDR=NO;DATABASE=E:\sample_entry.xls', 'Select * from [Sheet1$]'); ## Using BCP (bulk copy) we can write the output of a XPATH query to an xml file. declare @sql varchar(8000) SELECT @sql = 'bcp "SELECT TOP 5 * FROM AdventureWorks.HumanResources.Department for xml auto,elements" queryout c:\myXML.xml -c -t -T -S "MININT-CM4Q9R0\SQLSERVERDEV2008"' exec master..xp_cmdshell @sql before doing this The first thing you have to do is make sure xp_cmdshell is enabled EXEC master.dbo.sp_configure 'show advanced options', 1 RECONFIGURE EXEC master.dbo.sp_configure 'xp_cmdshell', 1 RECONFIGURE  ref: http://www.mssqltips.com/sqlservertip/1633/simple-way-to-export-sql-server-data-to-text-files/ http://thiagsundar.wordpress.com/export-data-to-text-file/

Oracle10g Installation with ASM in Oracle Virtual Box

--- Create ASM Disk -------- VBoxManage.exe createhd --filename asm1.vdi --size 4096 --format VDI --variant Fixed VBoxManage.exe createhd --filename asm2.vdi --size 4096 --format VDI --variant Fixed VBoxManage.exe storageattach ORALINUXASM --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium asm1.vdi --mtype shareable VBoxManage.exe storageattach ORALINUXASM --storagectl "SATA Controller" --port 2 --device 0 --type hdd --medium asm2.vdi --mtype shareable VBoxManage.exe modifyhd asm1.vdi --type shareable VBoxManage.exe modifyhd asm2.vdi --type shareable --- Output of the commands ------- C:\Program Files\Oracle\VirtualBox>VBoxManage.exe createhd --filename asm1.vdi --size 4096 --format VDI --variant Fixed 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Disk image created. UUID: 67e80984-5851-4643-92d4-d6c56798d725 C:\Program Files\Oracle\VirtualBox>VBoxManage.exe createhd --filename asm2.vdi --size 4096 --format VDI --varian

Connection Basic between Java and Oracle

1. Create ODBC driver for oracle if 32bit os and 32 bit oracle no issue. if 64bit os and 32 bit oracle issues !!! go to C:\Windows\SysWOW64\odbcad32.exe then add a new odbc (here i have created JavaOracleODBC) connection for oracle using username and password. 2. Open Eclipse and new project and write the below codes   import java.sql.*; public class dbconnection {     /**      * @param args      */     public static void main(String[] args) {         // TODO Auto-generated method stub         try{             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");         }catch (ClassNotFoundException e){             System.out.println(e.getMessage());         }         try{             Connection conection = DriverManager.getConnection("jdbc:odbc:JavaOracleODBC","scott","tiger");             Statement stmnt = conection.createStatement();             ResultSet rs = stmnt.executeQuery("select * from emp");             while(rs.next