Oracle 10g + TIMESTAMP
i am using dba_scheduler_jobs of oracle 10gR2.
i want to query all the jobs that havent run in the last 2 hours for ex.
if i do :
select * from dba_scheduler_jobs where sysdate-last_start_date > 2/24
i get oracle error.
does anyone got a good solution?
It is good practice to include the actual Oracle error messages instead of saying that "I got an error, what's wrong" so that board readers have a clue to what you are talking about!
My attempt to duplicate your error
O9I1 > select * from dba_scheduler_jobs where sysdate-last_start_date > 2/24;
select * from dba_scheduler_jobs where sysdate-last_start_date > 2/24
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected INTERVAL got NUMBER
Here is the fix (ran on 10gR1)
select *
from dba_scheduler_jobs
where sysdate - last_start_date > interval '2' Hour
HTH -- Mark D Powell --
Similar Messages
-
Oracle 10g - Issue with Timestamp
Hi All,We are having an issue with Oracle 10g and Hyperion Intelligence Explorer 8.3.1.133I can only use ODBC to connect to 10g. If I use SQL Net as my connection source I get the dreaded "An unknown error has occurred".Hyperion support tells us to roll back to 8i or just use ODBC until patch released.Anybody know of any workarounds?Regards,Mike
Nevermind.. a co-worker just told me that I still have to use parenthesis around the values for the IN clause.
-
Archive log mode in oracle 10g on windows environment
Hi All,
I have a production database (Oracle 10g 10.2.0.1.0) on windows 2003 server. yesterday i put the database into archivelog mode. when i query for spfile location it is shown in ORACLE_HOME\dbs location.
but when i created pfile using the spfile it is created at ORACLE_HOME\database location. and there is another spfile also. i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA.
today i seen archives are creating in both locations.
can a database have two spfiles. and working on them ?
can i remove a spfile in /dbs location.
pls. give me suggestion to rectify this
thanks and regards.Salman Qureshi wrote:
Hi,
On windows platform, spfile and initfiles are by default created under ORACLE_HOME\database directory and this is also the default location, so, your spfile or initfile in this directory are actually in use.
i set the log_archive_dest at a location other than flash_recovery_area in pfile, but it is showing the DB_RECOVER_AREA. You need to unset the "db_recovery_file_dest" parameter first.
alter system set db_recovery_file_dest='';Now set your log_archive_dest as follows
alter system set log_archive_dest_1="location=your_location";Don't user older "log_archive_dest" parameter
SalmanYour assertion that "You need to unset the "db_recovery_file_dest" parameter first." is patently false.
DB_RECOVERY_FILE_DEST is used for more than just archivelogs. Setting LOG_ARCHIVE_DEST_n to a location other than USE_DB_RECOVERY_FILE_DEST even while DB_RECOVERY_FILE_DEST is set is perfectly acceptable. In fact it is required if you want to continue to use the FRA for things other than archivelogs. Things, like - oh, say - backups!
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2011.02.15 07:42:18 =~=~=~=~=~=~=~=~=~=~=~=
login as: oracle
oracle@vmlnx01's password:
Last login: Tue Feb 15 07:01:51 2011 from 192.168.160.1
[oracle@vmlnx01 ~]$ sqlplus / as sysdbaFirst, note the date and time of logon, to compare to archivelog timestamps later ...
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Feb 15 07:42:27 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing optionsNext, note the values for the log_archive_dest_n parameters. Actually, the value for #10 is the default if no log_arch_dest_n parms are set, but I like to set it explicitly to avoid ambiguity.
SQL> show parameter log_archive_dest_
NAME TYPE VALUE
log_archive_dest_1 string
log_archive_dest_10 string LOCATION=USE_DB_RECOVERY_FILE_
DEST
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
NAME TYPE VALUE
log_archive_dest_state_1 string enable
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enableAnd note the setting for db_recovery_file_dest ...
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
db_recovery_file_dest string /orafra
db_recovery_file_dest_size big integer 4GNow lets check what's in the recovery dest. Notice there is no directory timestamped today (15 Feb), so no archivelogs have been generated for today.
SQL> !ls -l /orafra/VLNXORA1/archivelog
total 28
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14So lets force a log switch and check the results
SQL> alter system switch logfile;
System altered.
SQL> !ls -l /orafra/VLNXORA1/archivelog
total 32
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_08
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_09
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_10
drwxr-x--- 2 oracle oinstall 4096 Feb 11 17:53 2011_02_11
drwxr-x--- 2 oracle oinstall 4096 Feb 12 06:00 2011_02_12
drwxr-x--- 2 oracle oinstall 4096 Feb 13 11:00 2011_02_13
drwxr-x--- 2 oracle oinstall 4096 Feb 14 22:00 2011_02_14
drwxr-x--- 2 oracle oinstall 4096 Feb 15 07:43 2011_02_15
SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
total 1892
-rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcSo we see that, as expected, the archivelog was written to the FRA. Note the log sequence # of 82
Also, let's check my "alternate" location, as yet undefinded to the db ..
SQL> !ls -l /oraarch/vlnxora1
total 0No files there.
Now we will change the archivelog destination. Note that I am NOT touching the FRA definition
SQL> alter system set log_archive_dest_1='location=/oraarch/vlnxora1' scope=both;
System altered.
SQL> alter system set log_archive_dest_10 = '' SCOPE=both;
System altered.
SQL> show parameter log_archive_dest_
NAME TYPE VALUE
log_archive_dest_1 string location=/oraarch/vlnxora1
log_archive_dest_10 string
log_archive_dest_2 string
log_archive_dest_3 string
log_archive_dest_4 string
log_archive_dest_5 string
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
log_archive_dest_state_1 string enable
NAME TYPE VALUE
log_archive_dest_state_10 string enable
log_archive_dest_state_2 string enable
log_archive_dest_state_3 string enable
log_archive_dest_state_4 string enable
log_archive_dest_state_5 string enable
log_archive_dest_state_6 string enable
log_archive_dest_state_7 string enable
log_archive_dest_state_8 string enable
log_archive_dest_state_9 string enable
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
db_recovery_file_dest string /orafra
db_recovery_file_dest_size big integer 4GSo, above we see that I do not have an archivelog destination set to the FRA, but the FRA is still set. I did not unset it, as you asserted was necessary. I still want my backups to go there.
Next we'll do another log switch and check the results.
SQL> alter system switch logfile;
System altered.First, we'll check the (now unused) FRA destination. Notice that there is still just the one archivelog, sequence 82.
SQL> !ls -l /orafra/VLNXORA1/archivelog/2011_02_15
total 1892
-rw-r----- 1 oracle oinstall 1931776 Feb 15 07:43 o1_mf_1_82_6oo0qomc_.arcNow check the new, non-fra destination. Notice that it now has an archivelog, sequence 83
SQL> !ls -l /oraarch/vlnxora1
total 96
-rw-r----- 1 oracle oinstall 92160 Feb 15 07:45 1_83_732127364.dbf
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@vmlnx01 ~]$ exit
logout -
Recover Table in Oracle 10G - Very Urgent--Kindly Help
Hi Guru
I m using oracle 10G R2 in Unix. One of the user has unfortunately updated the table with wrong dataa aand hence we need to recover the table.
Our DB does not have flashbaack databaase option on.
For recovering the table using Flashback table point in time recovery, do we reqquire flaashback database option on?
If so then how can i recover the table?
Can i recover it theough RMAN??
Kindly Advise.
Thanks
Ram
Edited by: user448837 on Jan 8, 2010 5:55 PMI understand, but your post implies ("Because I have..") that you need to set a proper value for DB_FLASHBACK_RETENTION_TARGET for FLASHBACK TABLE to work and this is not the case.
For example:
SQL> ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=1;
System altered.
SQL> CREATE TABLE TEST AS SELECT * FROM DUAL;
Table created.
SQL> ALTER TABLE TEST ENABLE ROW MOVEMENT;
Table altered.
SQL> SHOW PARAMETER DB_FLASHBACK
NAME TYPE VALUE
db_flashback_retention_target integer 1
SQL> SHOW PARAMETER UNDO
NAME TYPE VALUE
undo_management string AUTO
undo_retention integer 86400
undo_tablespace string UNDOTBS
SQL> DELETE FROM TEST;
1 row deleted.
SQL> COMMIT;
Commit complete.
SQL> BEGIN DBMS_LOCK.SLEEP(120); END;
2 /
PL/SQL procedure successfully completed.
SQL> FLASHBACK TABLE TEST TO TIMESTAMP SYSTIMESTAMP - INTERVAL '2' MINUTE;
Flashback complete.
SQL> SELECT * FROM TEST;
D
X -
Flexible Audit_Trail output Format in Oracle 10g
Dear Friends ,
I have to configure audit_trail in oracle 10g , using
"audit_trail = xml"
or "audit_trail = xml,extended"
or "audit_trail = os"
Here I want to keep my user log in OS format not into DB format . But In the OS format I use the above options ("xml" , "xml,extended" , "OS" ) which are not actually not so easy format or a lengthy output format . I want a format where it is shown only "username", "HostIP","Timestamp", "Sql_text" .
Can I make it manually ? Or is there any other option to make it easy ?
plz inform ... ...
Waiting for ur kind reply .. ..You could set audit_trail=DB and then write your own SQLs to extract information
from the dba_audit_% views to flat files. -
In Oracle 10g global support system,I have set parameter of NLS_DATE_FORMAT.I am wondering about that whether it could affect the default value of NLS_TIMESTAMP_FORMAT?
Message was edited by:
frank.qiantest@ORCL> select sysdate from dual;
SYSDATE
24-NOV-06
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22-JUN-04 07.48.53.275 AM
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
test@ORCL> alter session set nls_date_format="MM/DD/YYYY";
Session altered.
Elapsed: 00:00:00.00
test@ORCL> select sysdate from dual;
SYSDATE
11/24/2006
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22-JUN-04 07.48.53.275 AM
PL/SQL procedure successfully completed.
test@ORCL> alter session set NLS_TIMESTAMP_FORMAT = 'DD/MM/YYYY HH:MI:SS.FF';
Session altered.
Elapsed: 00:00:00.00
test@ORCL> DECLARE
2 checkout TIMESTAMP(3);
3 BEGIN
4 checkout := '22-JUN-2004 07:48:53.275';
5 DBMS_OUTPUT.PUT_LINE( TO_CHAR(checkout));
6 END;
7 /
22/06/2004 07:48:53.275
PL/SQL procedure successfully completed.
Elapsed: 00:00:00.00
test@ORCL>
test@ORCL> -
Auditing in oracle 10g database and oracle 10g application server
Dear friends,
We have oracle 10g application server and oracle 10g database server in place.My criteria is to audit users connected using oracle application user credentials to the database.
Can you please tell me how can i do it.
Thanks & regards,Its the database connection you want to track. The session audit will show where it came from.
Auditing is turned using this command:
alter system set audit_trail = DB scope=spfile;
Note: The use of spfile will require a DB bounce before audit starts
To audit Sessions:
audit create session;
Query by Audit Type:
SELECT A.USERNAME,
OS_USERNAME,
A.TIMESTAMP,
A.RETURNCODE,
TERMINAL,
USERHOST
FROM DBA_AUDIT_SESSION A
WHERE USERHOST = <replace with iAS servername> ;
By User
SELECT USERNAME,OBJ_NAME,ACTION_NAME , TIMESTAMP
FROM DBA_AUDIT_TRAIL WHERE USERNAME = 'SCOTT';
Check for users sharing database accounts
select count(distinct(terminal)),username
from dba_audit_session
having count(distinct(terminal))>1
group by username;
Attempts to access the database at unusual hours
SELECT username, terminal, action_name, returncode,
TO_CHAR (TIMESTAMP, 'DD-MON-YYYY HH24:MI:SS'),
TO_CHAR (logoff_time, 'DD-MON-YYYY HH24:MI:SS')
FROM dba_audit_session
WHERE TO_DATE (TO_CHAR (TIMESTAMP, 'HH24:MI:SS'), 'HH24:MI:SS') <
TO_DATE ('08:00:00', 'HH24:MI:SS')
OR TO_DATE (TO_CHAR (TIMESTAMP, 'HH24:MI:SS'), 'HH24:MI:SS') >
TO_DATE ('19:30:00', 'HH24:MI:SS');
Attempts to access the database with non-existent users
SELECT username, terminal, TO_CHAR (TIMESTAMP, 'DD-MON-YYYY HH24:MI:SS')
FROM dba_audit_session
WHERE returncode <> 0
AND NOT EXISTS (SELECT 'x'
FROM dba_users
WHERE dba_users.username = dba_audit_session.username);
Other audits you might consider:
audit grant any object privilege;
audit alter user;
audit create user;
audit drop user;
audit drop tablespace;
audit grant any role;
audit grant any privilege;
audit alter system;
audit alter session;
audit delete on AUD$ by access;
audit insert on AUD$ by access;
audit update on AUD$ by access;
audit delete table;
audit create tablespace;
audit alter database;
audit create role;
audit create table;
audit alter any procedure;
audit create view;
audit drop any procedure;
audit drop profile;
audit alter profile;
audit alter any table;
audit create public database link;
Best Regards
mseberg -
Dropped sequences in oracle 10g
Hi All,
Can we get back the dropped sequences in oracle 10g?
Command?
Thanks.
Edited by: user545846 on Apr 9, 2009 7:32 AMThanks. Oracle site is accessible.
This user has the dba previleges to select all tables. but still getting this error message:
SQL> SELECT * FROM dba_sequences AS OF TIMESTAMP systimestamp - 1/24;
SELECT * FROM dba_sequences AS OF TIMESTAMP systimestamp - 1/24
ORA-01031: insufficient privileges
Please give your comment. -
Imp full oracle 10G database window 2003
Hi Experts,
I made a full data based exp as
exp USERID=SYSTEM/scott@cas full=y FILE=D:\Oraclebackup\CAS\exports\casdatabase_042009.dmpLOG=D:\Oraclebackup\CLS\exports\logs\exportTables_042009.log OBJECT_CONSISTENT=Y STATISTICS=NONE
then I create a blank database with new DBname in Oracle 10G in window 32 bit 2003
I try to imp this full data exp. However I got lots of message as
importing SYSTEM's objects into SYSTEM
IMP-00061: Warning: Object type "SYSTEM"."REPCAT$_OBJECT_NULL_VECTOR" already exists with a different identifier
"CREATE TYPE "REPCAT$_OBJECT_NULL_VECTOR" TIMESTAMP '2005-10-17:13:31:32' OI"
"D '306C410305254B08A55576824763662E' AS OBJECT"
" -- type owner, name, hashcode for the type represented by null_vector"
" type_owner VARCHAR2(30),"
" type_name VARCHAR2(30),"
" type_hashcode RAW(17),"
" -- null_vector for a particular object instance"
" -- ROBJ REVISIT: should only contain the null image, and not version#"
" null_vector RAW(2000)"
IMP-00061: Warning: Object type "OLAPSYS"."ALL_OLAP2_AW_METADATA_O" already exists with a different identifier
"CREATE TYPE "ALL_OLAP2_AW_METADATA_O" TIMESTAMP '2005-10-17:13:45:23' OID '"
"B8722EEBE57D428296D658C522D2209F' AS OBJECT ("
It seems that try to duplicate system/sys objects
aslo I got message as
ORA-04052: error occurred when looking up remote object [email protected]
ORA-00604: error occurred at recursive SQL level 1
ORA-02019: connection description for remote database not found
Please let me know if you have experience for full database IMP.
Thanks,
JiMThese types of errors are expected. The problem is that types and tables are created as the database gets created. As far as I know SYS owned objects are never exported/imported, but other schema objects are exported and imported. These types of errors are generally ok since the object exists in the target database when the database is created with certain objects.
I'm not familar with this error:
ORA-04052: error occurred when looking up remote object [email protected]
Dean -
How to migrate a table from ORACLE 10g to 8i
have table named 'liuxg_tab_01' in 10g.
This morning I exported this table using 'exp' and then tried to imp it into 8i, I failed.
After a while, I created a database link named 'ctf' in 8i which connected to 10g. I issued 'create table test as selct * from liuxg_tab_01@ctf',it returns 'ORA-01723'.
Then I extraced the DDL of 'liuxg_tab_01' from 10g with QUEST TAOD, it's:
CREATE TABLE LIUXG_TAB_01
OWNER VARCHAR2(30 BYTE),
OBJECT_NAME VARCHAR2(30 BYTE),
SUBOBJECT_NAME VARCHAR2(30 BYTE),
OBJECT_ID NUMBER,
DATA_OBJECT_ID NUMBER,
OBJECT_TYPE VARCHAR2(19 BYTE),
CREATED DATE,
LAST_DDL_TIME DATE,
TIMESTAMP VARCHAR2(19 BYTE),
STATUS VARCHAR2(7 BYTE),
TEMPORARY VARCHAR2(1 BYTE),
GENERATED VARCHAR2(1 BYTE),
SECONDARY VARCHAR2(1 BYTE)
But I can not create a table using the upper DDL in 8i if I do not wipe off those "BYTES".
After creation of the table using the upper DDL without those 'BYTES', I sucessfully executed 'insert into LIUXG_TAB_01 select * from liuxg_tab_01@ctf'.
Anyone has a better method to move a table from ORACLE 10g to 8i?1) The particular version of 8i and 10g in use here would be useful. I'm not sure that Oracle supports database links between any version of 8i and any version of 10g, though, so you're probably lucky that it worked as well as it did.
10g 10.1.0.3.0 and 8i 8.1.7.0.0
2) What version of the export utility did you use? You would need to use the 8i version to generate the dump file to have any chance of working, not the 10g verion.
I use the 'exp' provided with 10g 10.1.0.3.0 and 'imp' with 8i 8.1.7.0.0. I have tried to export data directly from 10g 10.1.0.3.0 using 'exp' provided with 8i 8.1.7.0.0. Failed.
3) Why? Since 8i is desupported, there isn't a lot of call for tools to move data from supported releases to unsupported releases.
We have an 8i DB which is still porivding insentive services. We just wanna migrate some tales from 10g to it.
FYI, NLS_LENGTH_SEMANTICS was introduced in 9i, so it's no suprise that 8i objected to the BYTE keyword in the DDL.
What's FYI :P
Another option would be to generate a CSV file of the data from 10g and use SQL*Loader to load it into 8i. Not sure this would be any easier, though.
Justin
Message was edited by:
user510846 -
Oracle 10g Reports: Control Break using Group By Rollup
Oracle 10g Contol-Break Reporting
Hello. I am trying to create a report using Group By Rollup. The report should look like:
MONTH......._WEEK_..... CODE.... TOTAL
JULY..........WEEK 1..... K1...........2
............................. K1...........2
.............................SUB:.........4
................WEEK 2..... K1...........2
............................. K1...........2
.............................SUB:.........4
...............WEEK 3..... K1...........2
............................. K1...........2
.............................SUB:.........4
...............WEEK 4..... K1...........2
............................. K1...........2
.............................SUB:.........4
..........................MTH Tot:.....16
AUG..........WEEK 1..... K1...........2
............................. K1...........2
.............................SUB:.........4
................WEEK 2..... K1...........2
............................. K1...........2
.............................SUB:.........4
...............WEEK 3..... K1...........2
............................. K1...........2
.............................SUB:.........4
...............WEEK 4..... K1...........2
............................. K1...........2
.............................SUB:.........4
..........................MTH Tot:.....16
..........................GRND TOT: 32
Not sure how to group the codes into the correct month/week and the labels are a problem. Here is the table/data and a my poor attempt at using the Group by rollup. I'm still working on it but any help would be very nice.
create table translog
ttcd VARCHAR2(5) not null,
stime TIMESTAMP(6) not null,
etime TIMESTAMP(6)
insert into translog ( TTCD, STIME, ETIME)
values ('T4', '01-JUL-12 12.00.01.131172 AM', '01-JUL-12 12.00.16.553256 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T4', '01-JUL-12 12.00.17.023083 AM', '01-JUL-12 12.00.37.762118 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('K2', '01-JUL-12 12.00.38.262408 AM', '01-JUL-12 12.00.40.686331 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('U1', '01-JUL-12 12.00.40.769385 AM', '01-JUL-12 12.00.41.281300 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('SK4', '08-JUL-12 12.00.41.746175 AM', '08-JUL-12 12.00.51.775487 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '08-JUL-12 12.00.53.274039 AM', '08-JUL-12 12.00.53.802800 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1','08-JUL-12 12.00.54.340423 AM', '08-JUL-12 12.01.03.767422 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '08-JUL-12 12.01.04.699631 AM', '08-JUL-12 12.01.04.744194 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('S2', '15-JUL-12 12.01.04.796472 AM', '15-JUL-12 12.01.04.817773 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '15-JUL-12 12.01.04.865641 AM', '15-JUL-12 12.01.05.154274 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '15-JUL-12 12.01.05.200749 AM', '15-JUL-12 12.01.05.508953 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '15-JUL-12 12.01.06.876433 AM', '15-JUL-12 12.01.07.510032 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '15-JUL-12 12.01.07.653582 AM', '15-JUL-12 12.01.07.686764 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('S2', '15-JUL-12 12.01.07.736894 AM', '15-JUL-12 12.01.08.163321 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-JUL-12 12.01.08.297696 AM', '22-JUL-12 12.01.08.562933 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '22-JUL-12 12.01.08.583805 AM', '22-JUL-12 12.01.08.620702 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-JUL-12 12.01.08.744821 AM', '22-JUL-12 12.01.08.987524 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-JUL-12 12.01.09.096695 AM', '22-JUL-12 12.01.09.382138 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-JUL-12 12.01.09.530122 AM', '22-JUL-12 12.01.10.420257 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '01-AUG-12 12.01.10.550234 AM', '01-AUG-12 12.01.10.581535 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('S2', '01-AUG-12 12.01.10.628756 AM', '01-AUG-12 12.01.10.656373 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '01-AUG-12 12.01.10.740711 AM', '01-AUG-12 12.01.10.768745 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '01-AUG-12 12.01.10.819635 AM', '01-AUG-12 12.01.10.900849 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '01-AUG-12 12.01.09.530122 AM', '01-AUG-12 12.01.10.420257 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '08-AUG-12 12.01.11.231004 AM', '08-AUG-12 12.01.24.073071 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '08-AUG-12 12.01.24.202920 AM', '08-AUG-12 12.01.24.244538 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('S2', '08-AUG-12 12.01.24.292334 AM', '08-AUG-12 12.01.24.318852 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '08-AUG-12 12.01.24.362643 AM', '08-AUG-12 12.01.24.397662 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1','15-AUG-12 12.01.09.530122 AM', '15-AUG-12 12.01.10.420257 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1', '15-AUG-12 12.01.24.414572 AM', '15-AUG-12 12.01.24.444615 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L2W', '15-AUG-12 12.01.24.478739 AM', '15-AUG-12 12.01.25.020265 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('K4', '15-AUG-12 12.01.25.206721 AM', '15-AUG-12 12.01.25.729493 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '15-AUG-12 12.01.25.784746 AM', '15-AUG-12 12.01.39.226921 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1','15-AUG-12 12.01.39.517953 AM', '15-AUG-12 12.01.50.775295 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-AUG-12 12.01.57.676446 AM', '22-AUG-12 12.01.58.252945 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-AUG-12 12.01.09.530122 AM', '22-AUG-12 12.01.10.420257 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-AUG-12 12.01.58.573242 AM', '22-AUG-12 12.02.10.651922 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('L1', '22-AUG-12 12.02.11.209305 AM', '22-AUG-12 12.02.24.140456 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('SK4','22-AUG-12 12.02.25.204035 AM', '22-AUG-12 12.02.25.580603 AM');
insert into translog ( TTCD, STIME, ETIME)
values ('T1','22-AUG-12 12.02.25.656474 AM', '22-AUG-12 12.02.25.689249 AM');
select
decode(grouping(trunc(stime)),1, 'Grand Total: ', trunc(stime)) AS "DATE"
,decode(grouping(ttcd),1, 'SUB TTL:', ttcd) CODE,count(*) TOTAL
from translog
group by rollup (trunc(stime),ttcd);}
Thank you.830894 wrote:
Oracle 10g Contol-Break Reporting
Hello. I am trying to create a report using Group By Rollup. The report should look like:Couple of things:
1) Your test data setup dows not match with your expected output &
2) layout of data (like control break) should ideally be carried out using reporting tools
Here is what you are probably looking for:
SQL> select * from v$version ;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> create table translog
2 (
3 ttcd VARCHAR2(5) not null,
4 stime TIMESTAMP(6) not null,
5 etime TIMESTAMP(6)
6 );
Table created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T4', '01-JUL-12 12.00.01.131172 AM', '01-JUL-12 12.00.16.553256 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T4', '01-JUL-12 12.00.17.023083 AM', '01-JUL-12 12.00.37.762118 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('K2', '01-JUL-12 12.00.38.262408 AM', '01-JUL-12 12.00.40.686331 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('U1', '01-JUL-12 12.00.40.769385 AM', '01-JUL-12 12.00.41.281300 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('SK4', '08-JUL-12 12.00.41.746175 AM', '08-JUL-12 12.00.51.775487 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '08-JUL-12 12.00.53.274039 AM', '08-JUL-12 12.00.53.802800 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1','08-JUL-12 12.00.54.340423 AM', '08-JUL-12 12.01.03.767422 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '08-JUL-12 12.01.04.699631 AM', '08-JUL-12 12.01.04.744194 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('S2', '15-JUL-12 12.01.04.796472 AM', '15-JUL-12 12.01.04.817773 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '15-JUL-12 12.01.04.865641 AM', '15-JUL-12 12.01.05.154274 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '15-JUL-12 12.01.05.200749 AM', '15-JUL-12 12.01.05.508953 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '15-JUL-12 12.01.06.876433 AM', '15-JUL-12 12.01.07.510032 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '15-JUL-12 12.01.07.653582 AM', '15-JUL-12 12.01.07.686764 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('S2', '15-JUL-12 12.01.07.736894 AM', '15-JUL-12 12.01.08.163321 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-JUL-12 12.01.08.297696 AM', '22-JUL-12 12.01.08.562933 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '22-JUL-12 12.01.08.583805 AM', '22-JUL-12 12.01.08.620702 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-JUL-12 12.01.08.744821 AM', '22-JUL-12 12.01.08.987524 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-JUL-12 12.01.09.096695 AM', '22-JUL-12 12.01.09.382138 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-JUL-12 12.01.09.530122 AM', '22-JUL-12 12.01.10.420257 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '01-AUG-12 12.01.10.550234 AM', '01-AUG-12 12.01.10.581535 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('S2', '01-AUG-12 12.01.10.628756 AM', '01-AUG-12 12.01.10.656373 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '01-AUG-12 12.01.10.740711 AM', '01-AUG-12 12.01.10.768745 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '01-AUG-12 12.01.10.819635 AM', '01-AUG-12 12.01.10.900849 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '01-AUG-12 12.01.09.530122 AM', '01-AUG-12 12.01.10.420257 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '08-AUG-12 12.01.11.231004 AM', '08-AUG-12 12.01.24.073071 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '08-AUG-12 12.01.24.202920 AM', '08-AUG-12 12.01.24.244538 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('S2', '08-AUG-12 12.01.24.292334 AM', '08-AUG-12 12.01.24.318852 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '08-AUG-12 12.01.24.362643 AM', '08-AUG-12 12.01.24.397662 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1','15-AUG-12 12.01.09.530122 AM', '15-AUG-12 12.01.10.420257 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1', '15-AUG-12 12.01.24.414572 AM', '15-AUG-12 12.01.24.444615 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L2W', '15-AUG-12 12.01.24.478739 AM', '15-AUG-12 12.01.25.020265 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('K4', '15-AUG-12 12.01.25.206721 AM', '15-AUG-12 12.01.25.729493 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '15-AUG-12 12.01.25.784746 AM', '15-AUG-12 12.01.39.226921 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1','15-AUG-12 12.01.39.517953 AM', '15-AUG-12 12.01.50.775295 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-AUG-12 12.01.57.676446 AM', '22-AUG-12 12.01.58.252945 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-AUG-12 12.01.09.530122 AM', '22-AUG-12 12.01.10.420257 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-AUG-12 12.01.58.573242 AM', '22-AUG-12 12.02.10.651922 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('L1', '22-AUG-12 12.02.11.209305 AM', '22-AUG-12 12.02.24.140456 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('SK4','22-AUG-12 12.02.25.204035 AM', '22-AUG-12 12.02.25.580603 AM');
1 row created.
SQL> insert into translog ( TTCD, STIME, ETIME)
2 values ('T1','22-AUG-12 12.02.25.656474 AM', '22-AUG-12 12.02.25.689249 AM');
1 row created.
SQL> commit ;
Commit complete.
SQL> select case when row_number() over (partition by mth order by mth, wk, ttcd) = 1 then mth end as "Month"
2 ,case when row_number() over (partition by mth, wk order by mth, wk, ttcd) = 1 and wk is not null then 'WEEK '||wk end as "Week"
3 ,case when gttcd = 1 and gwk = 0 and gmth = 0 then 'SUB:'
4 when gttcd = 1 and gwk = 1 and gmth = 0 then 'Month Total:'
5 when gttcd = 1 and gwk = 1 and gmth = 1 then 'Grand Total:'
6 else ttcd
7 end as "Code"
8 ,cnt as "Total"
9 from (
10 select trunc(stime, 'MM') as mth, to_char(stime, 'W') as wk, ttcd, count(*) as cnt
11 ,grouping(trunc(stime, 'MM')) as gmth, grouping(to_char(stime, 'W')) as gwk, grouping(ttcd) as gttcd
12 from translog
13 group by rollup(trunc(stime, 'MM'), to_char(stime, 'W'), ttcd)
14 order by trunc(stime, 'MM'), to_char(stime, 'W'), ttcd
15 ) ;
Month Week Code Total
01-JUL-12 WEEK 1 K2 1
T4 2
U1 1
SUB: 4
WEEK 2 L1 2
SK4 1
T1 1
SUB: 4
WEEK 3 L1 1
S2 2
T1 3
SUB: 6
WEEK 4 L1 4
T1 1
SUB: 5
Month Total: 19
01-AUG-12 WEEK 1 L1 1
S2 1
T1 3
SUB: 5
WEEK 2 L1 1
S2 1
T1 2
SUB: 4
WEEK 3 K4 1
L1 3
L2W 1
T1 1
SUB: 6
WEEK 4 L1 4
SK4 1
T1 1
SUB: 6
Month Total: 21
Grand Total: 40
35 rows selected. -
Hi
My company need to set database real time backup for Oracle 10g release 2 (Standard Edition).
I see in Oracle Database 10g Product Family [Oracle Database 10g Product Family|http://www.oracle.com/technology/products/database/oracle10g/pdf/twp_general_10gdb_product_family.pdf] not support the Data Guard.
Can I do it in Oracle 10g SE ?
Thanks in advancehi,
trouble is the cost of EE can be quite expensive
another way of creating a psuedo (hope I spelt that correctly) dataguard would be to script a method of shipping archive files to a DR server.
Live System
=========
BEGIN
IF ORACLE ONLINE THEN
SWITCH LOG;
END IF;
IF ANOTHER INSTANCE OF SCRIPT RUNNING (LOCAL OR REMOTE) THEN
ERROR;
EXIT;
END IF;
IF (STANDBY NOT ONLINE) THEN
ERROR;
SEND EMAIL;
EXIT;
END IF;
GET LAST SHIPPED LOG FILE TIMESTAMP FROM THE REMOTE SITE OR FROM LOCAL SERVER;
WHILE LOG > SHIPPED LOG FILE TIMESTAMP DO
TRANSFER LOG FILE TO REMOTE SITE;
DO CHECKSUM ON LOG FILES;
IF NOT MATCH THEN
RETRY TRANSFER;
IF FAILURE 3 TIME THEN
ERROR;
SEND EMAIL;
END IF;
END IF;
' GOT THIS FAR SO ALL IS OK
MARK THE LOG FILE AS TRANSFERRED;
WEND;
DR System
========
BEGIN
CREATE A LOCK SEMAPHORE; - Only one instance allowed
CHECK LAST APPLIED LOG FILE;
IF CONNECTION TO LIVE SERVER OK THEN
CHECKSUM NEXT LOG FILE WITH LIVE SYSTEM;
IF CHECKSUM NOT SAME THEN
IF LOG FILE ON ITS WAY FROM LIVE THEN
EXIT;
END IF;
WHILE LOGFILE EXISTS DO
GET NEXT LOG FILE FROM LIVE;
WEND;
END IF;
ELSE
' Extra work
APPLY NEXT LOG FILE
END IF;
APPLY LOG FILES;
WORKOUT NO OF LOG FILE APPLIED;
KEEP SPECIFIED PERCENTAGE LOG FILES;
DELETE EXTRA LOG FILES;
TRANSFER LAST APPLIED LOG FILE ATTRIBUTES TO LIVE SERVER;
EXIT;
END; I cannot give you the actual code that I have as there are some more bits that I have added for our client but what it does is give you an over view of the process involved for creating a pseudo DG environment.
regards
Alan -
Hi experts,
We have tried to flashback the data from oracle 10g database. for this we have executed AS OF TIMESTAMP query, the Undo has been set 900 and db_flashback_retention_target also 1440 but we can get 4 days old data with help of 'AS OF TIMESTAMP" query, Can you please clarify is there any internal table is for maintaing the old data since undo retention value also very small archive log file also deleted every 4 hours once , then how its possible to get the 4 days old data, where the old data actually stored? Please help on this.Your old data is stored in UNDO segments. In order to flash back as of timestamp (4 days prior), you must set UNDO retention to 4 days or higher (900 Seconds is default). You must also ensure your UNDO tablespace is sized large enough to hold all data to satisfy retention.
You will not be able to perform flashback on the table if there were any DDL's executed on the table and structure of table is changed since 4 days..
Thanks -
Error while installing Oracle 10g on Fedora Core 1
Error while installing Oracle 10g on Fedora Core 1. After 40% of the Installation is thru, the progress bar is showing 40%, it gives error "Not connected to Oracle" and the installation has to be terminated.
We have tried by using the on-line procedure and changing the required script to make believe it as said.Are you createing DB also???
-
Error while sending a mail using UTP_MAIL package in Oracle 10g
Hi,
We are using UTP_MAIL package to send a mail from Oracle 10g.We have follwed the following steps ...
SQL> connect sys/password as sysdba
Connected.
SQL> @$ORACLE_HOME/rdbms/admin/utlmail.sql
Package created.
Synonym created.
SQL> @$ORACLE_HOME /rdbms/admin/prvtmail.plb
Package body created.
SQL > alter system set smtp_out_server = '<mail_server_ip:25>' scope =spfile;
System altered..
Now we try the code
begin
utl_mail.send(
sender => 'sender's mail',
recipients => 'receiver mail',
CC => 'optional',
subject => 'Testing utl_mail',
message => 'Test Mail'
end;
But we get the following error...
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 97
ORA-06512: at "SYS.UTL_SMTP", line 139
ORA-06512: at "SYS.UTL_MAIL", line 405
ORA-06512: at "SYS.UTL_MAIL", line 594
ORA-06512: at line 2
We also tried connecting to the mail server through telnet .But it is not getting connected..
Please help us to solve the issue.From your own posting you may have the clue, if you try to access your mail server through telnet and it is not successful, it means the service is down or there are networking issues.
On pre 10gR2 versions there was a bug 4083461.8. It could affect you if you are on 10gR1
"Bug 4083461 - UTL_SMTP.OPEN_CONNECTION in shared server fails with ORA-29278 Doc ID: Note:4083461.8"
This was fixed on 10gR2 base and on 9.2.0.8.0
~ Madrid
Maybe you are looking for
-
I can't see the option for yahoo in the sync contacts section of i tunes
when I go into i tunes (with my iphone 4S contected to my pc - and click on the info tab - I can see the 'sync contacts with' option - the drop down box to the right of this offers me the options to sync with - outlook, google contacts & windows cont
-
Hello! I bought an iPod touch 3rd gen at a pawn shop and when i tried to set it up, it would not connect to my iTunes OR Wifi so that I could finish set up. Is there anything I can do to fix this before i take it back and get my money back?
-
JSF 1.0 and Portlet API
Does JSF and Portlet API works together? Can we use JSF 1.0 for portlet JSP development?
-
Need ideas to make talking head video dynamic
We are producing a DVD curriculum that will be comprised primarily of a talking head but with some slides thrown in. Our first takes are very boring--we have hours of video to produce on several DVD's. Does anyone know of ideas or idea websites with
-
No sound in youtube but sound in iTunes
Have done the updates for the mountain lion; but still can not get any sound with itunes. How do I get the sound throughout computer?