Monday, November 5, 2012

Oracle: syntax to Alter materialized view

Alter materialized view MV_NAME

refresh complete

start with trunc(sysdate)+17/24

next trunc(sysdate) - to_number(to_char(sysdate - 1, 'd')) + 5;

 

 

Thanks & Regards

Fauzi

 

Tuesday, October 30, 2012

SQL to list the number of database files in Oracle Database

Hi there,

 

Found this interesting query which will list you all the DB files holding your database:

 

select    name, bytes

from    (select    name, bytes

    from    v$datafile

    union    all

    select    name, bytes

    from     v$tempfile

    union     all

    select     lf.member "name", l.bytes

    from    v$logfile lf

    ,    v$log l

    where    lf.group# = l.group#) used

,    (select sum(bytes) as poo

    from dba_free_space) free

/

 

Hope it helps,

 

Regards

Fauzi

Thursday, October 11, 2012

How to select distinct Columns from DataTable C#

Following is the code helpful to filter distinct columns from a DataTable

 

DataTable distinctDT = dtSOURCE.DefaultView.ToTable("TAB_NAME", true, "YourCOLUMN");

 

Time to rush back to Visual Studio Bye J

Monday, April 30, 2012

Oracle: To Display list of table spaces

SELECT dd.tablespace_name tablespace_name, dd.file_name file_name, dd.bytes/1024 TABLESPACE_KB, SUM(fs.bytes)/1024 KBYTES_FREE, MAX(fs.bytes)/1024 NEXT_FREE

FROM sys.dba_free_space fs, sys.dba_data_files dd

WHERE dd.tablespace_name = fs.tablespace_name

AND dd.file_id = fs.file_id

GROUP BY dd.tablespace_name, dd.file_name, dd.bytes/1024

ORDER BY dd.tablespace_name, dd.file_name;

Monday, April 9, 2012

Oracle SQL Thread: Convert String to Datetime

Found this link useful

 

https://forums.oracle.com/forums/thread.jspa?threadID=598694

 

select to_date('2007-01-01 12:00:01 AM','yyyy-mm-dd hh:mi:ss pm') as dt from dual;

 

Wednesday, March 28, 2012

ORA-22858: invalid alteration of datatype, ORA-22858: invalid alteration of datatype

When we try to modify a datatype from varchar2(400) to Clob in a Oracle table, we’ll get the following error:

 

The following steps is the work-around to solve this issue:

 

ALTER TABLE SCHEMANAME.TABLENAME ADD NEWCOLUMN CLOB;

 

UPDATE SCHEMANAME.TABLENAME SET NEWCOLUMN = OLDCOLUMN;

 

ALTER TABLE SCHEMANAME.TABLENAME drop COLUMN OLDCOLUMN;

 

ALTER TABLE SCHEMANAME.TABLENAME rename COLUMN NEWCOLUMN TO OLDCOLUMN;

 

 

To Search for a text in All the files in a folder in Windows 7

Hello,

 

In windows 7 - I want to search for all files containing "A word or phrase in the file". The standard XP search box, But I was not able to get the result until I did the following steps.

 

Hope it is helpful for people who is looking for the same feature.

 

http://answers.microsoft.com/en-us/windows/forum/windows_7-files/in-windows-7-i-want-to-search-for-all-files/aadfe1f1-4a33-406b-8e72-bb920efa4f30