, I'd like to create a constraint (when creating a table) that checks to ensure that the 'Year' entered is less than or equal to the current year (based off SYSDATE). Per the code below, I keep getting the same error, "missing right parenthesis". I've spent more than an hour trying different ways to get this to work, but I've been failing miserably. I am using Oracle 11g Express.
CREATE TABLE TEST (Name VARCHAR2(7) PRIMARY KEY, Year NUMBER(4), CONSTRAINT TEST_YEAR_CK CHECK (Year <= (TO_NUMBER(TO_CHAR(SYSDATE, 'YYYY')))FROM DUAL); *ERROR at line 4:ORA-00907: missing right parenthesis
I have a table say EMP with 2 fields ID and Name, with ID being the primary key. The name of the primary key constraint is ID_PK.Now my scenario is :
1. Rename the table EMP to EMP_TEMP; 2. Create an empty table EMP 3. If (data successfully loaded into EMP) { Drop EMP_TEMP; } else { Drop EMP; Rename EMP_TEMP to EMP; }
The problem here for me is the primary key constraint. When I am in 2, I cannot create the primary key constraint again since the old one is still in tact. If I go ahead to drop the original pk constraint and re-create a new one in 2, then in case of else part , I need to get the constraint again while renaming the original table.
I have in a plsql block somewhere a statement like
INSERT INTO TABLE1( id , col) SELECT id, col FROM TABLE2;
This statement returns an error ORA-00001: unique constraint because id is a primary key on TABLE1. I would like to know what is the value of id that raised the exception.
when I check one database, I noticed that the primary key constraint is in UNUSABLE status. But when I check the table, the table DDL itself,the below query mentioned.
ALTER INDEX "COMMON_DATA"."PK_DISE_MOBILE" UNUSABLE ENABLE
suggest whether I need rebuild this index? if I rebuild this index, will it useful for me for the performance improvement? But the table has only 578234 records.
i'm new to oracle environment.how can i specify NONCLUSTERD INDEX on Primary cloumn during table creation.By default it will create clusterd index but i need non-clusterd index on it.
I'm using following stmt to create normal primary constarint during table creation,
CONSTRAINT PKFORM_PROPS PRIMARY KEY (FORM_PROPS_PK) USING INDEX TABLESPACE DB123_INDEX
how can i change the above query, so that it should create NONCLUSTERED INDEX on Primary key column.
primary key constraint on transaction_dtl_bk is affecting the insertion of next correct rows.
CREATE OR REPLACE PROCEDURE NP_DB.san_po_nt_wnpg_1 ( dt DATE ) IS v_sql_error VARCHAR2 (100); -- added by sanjiv v_sqlcode VARCHAR2 (100); ---- added by sanjiv added by sanjiv
Query in format Query@DB_Link is sometimes dropping transactions. Move it to a package on target dababase "B" called from DATABASE "A" via package.procedure(varaibles);
Is that all I need to do to get the transaction to always go? I tried a commit in the package body, with repeated attempts if it fails. Btu when I use commit, the package doesn't work. (Compiles fine) Why would the commit fail?
My goal is to make that the transaction succeeds.Code for what I tried below. the COMMIT is commented out - if I uncomment it, the transaction fails. I have done this before calling an oracle SP from SQLServer and it worked
Comments:
The loop is to avoid an endless cycle..The concept is to perform the update, commit it, if the commit fails, rollback and try again.I'm not sure if I even need a loop, but I don't know if the unresolved transaction would get fixed by the remote DB, or dropped.
I would like to know that if I enable backup Optimization on then incremental full backup skip any files which was earlier backup? Because we may know that backup Optimization on ensure skip those files which are already taken backup.
There is a readonly user on our reporting server. Developers want to use global temporary tables with this user. I don't want the user to have permissions other than readonly.I can grant the user CREATE TABLE privilege and did not grant quota on any permanent tablespace, therefore user would not be unable to create permanent tables but still should be able to create global temporary tables.
Question is would a user with such permissions still be able to utilize temp tables as part of a scheduled job?
i have a very complex layout which i want to print like delimited as well as spreadsheet.How can i utilize both formatted in my report because i want spreadsheet but it is coming in group while same report in delimited is comming like tabular means same report in tabular spreadsheet i need.
For one of my OLTP table, we have skewed distribution on STATUS column and hence we created frequency histograms. NDV=7 for this column.
My question is : Do we need to have "_optim_peek_user_binds" set to TRUE in order to utilize Adaptive Cursor Sharing ?I have gone through different OTN forum and blogs and it appears that in order to generate different plans, Oracle has to Peek the value of bind variables each time. Without Peeking, how would CBO knows whether to generate new plans or not ?
For xyz reasons, optimpeek_user_binds is set to FALSE in my database and i could not find any sql_id having V$SQL.IS_BIND_AWARE='Y'.
i want to get table name, constraint name, constraint type with join processes in string type. this is what i want: alter table tablename add constraint constraintname constrainttype(columnname)
I am using RAC to RAC data guard environment. Os hp-unix. during primary(old standby) to standby(old primary) switchover I am ussing:
SQL>ALTER DATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;
I have 11.2.0.1 environment with standby and when performing switch over - it was hanging for more than 2 hours and i had to cancel it. This is what all i see in the database alert.log:
Errors in file /u02/app/oracle/diag/rdbms/drpdb/drpdb1/trace/drpdb1_m000_15160.trc: ORA-01155: the database is being opened, closed, mounted or dismounted Thu Apr 04 17:44:03 2013 Errors in file /u02/app/oracle/diag/rdbms/drpdb/drpdb1/trace/drpdb1_m000_15780.trc: ORA-01155: the database is being opened, closed, mounted or dismounted Thu Apr 04 17:59:03 2013 Errors in file /u02/app/oracle/diag/rdbms/drpdb/drpdb1/trace/drpdb1_m001_16373.trc:
[code]....
ORA-01155: the database is being opened, closed, mounted or dismounted.
I wanted to make my11g cluster down along with high availability.Documents says, Stop the cluster stack by using crsctl stop cluster and then execute crsctl stop crs command to stop HA. What is the difference if I am using the following commands?
1. crsctl stop cluster crsctl stop crs
OR
2. crsctl stop crs
As per my understanding, crsctl stop crs command stops entire cluster stach plus has.
We are going to setup a 4 node rac cluster. So i think we need to configure only one SCAN with 3IP's. And how the scan listeners are configured on these 4 nodes.
We have few Solaris RAC Clusters. When I try to query the cluster name from server using the following command i get the same result for all the clusters.
soc02n02-oracle> cemutlo -n -w ORA_CRS_01 2:1:
soc03n01-oracle> cemutlo -n -w ORA_CRS_01 2:1:
While in the OEM Grid Console it shows the separate name given to each of them. Check the attached .pdf
Q.Why the cluster names are same from the OS level but different in the OEM console. Q.Is there any way we can find out the individual cluster names other than cemutlo commands. Q.In OEM why is the "Cluster" different from the "Cluster name"
A basic select and group by query I am optimising for my Database course has returned results that indicate it will perform better on a clustered index when returning a smaller number of rows (5% of the largest table) and on a hash clustered index when returning higher volumes (50% and 80%). I understand that it is possible to use more than one index type on a table to improve performance, but I am struggling to understand how I might establish a hash cluster and a cluster on the same table? and then use hints to drive the query down one access path or the other.
I have one table called posh, which has about 50,000 ids (millions of rows) so far. It is currently at about 50 gb. So each series of rows for a particular id is about 1 mb.
CREATE CLUSTER posh_cluster (id int) SIZE 2M STORAGE (initial 2000K next 2000K) PARALLEL 4; CREATE INDEX posh_cluster_index ON CLUSTER posh_cluster;
[code].......
According to the Oracle documentation size is "the average cluster key size", I am not really sure what that means. Is this the 1mb in posh table space I am using for each series of rows for an id, or the space used for the index? Secondly, the storage parameter for 'CREATE CLUSTER' should be what?
I have table property and flat , in both of these tables I have cvp_id common colomn .Now I want to add cluster on this colomn so how can I add cluster to table which is already exists.
I have a table called dept table with nested collection as below. Nested Table Collection:
create or replace type courselist as table of varchar2(64) Table Using Nested Table Collection: CREATE TABLE "FCSDWH_STG"."DEPT" ( "NAME" VARCHAR2(20 BYTE), "DIRECTOR" VARCHAR2(20 BYTE), "OFFICE" VARCHAR2(20 BYTE), "COURSES" "FCSDWH_STG"."COURSELIST" ) Content Of Table:NameDirectorofficecoursesAccountingJames CharlesUNOFCSDWH_STG.COURSELIST('natural science','chemistry','Computer Science','Computer Science')
I am trying to select and print an element from nested table collection using below plsql block.
MY_COURSE VARCHAR2(64 CHAR); BEGIN SELECT courses INTO MY_COURSE FROM TABLE(SELECT COURSES FROM DEPT) where courses='chemistry'; DBMS_OUTPUT.PUT_LINE(MY_COURSE); END; Error Message: PL/SQL: ORA-00904: "COURSES": invalid identifier
on 6th of August at 02:36 our following cluster services were down,i see the logs and found that ASM is down and disk group are not accessible and ASMb process is terminated and both instances was restarted, i checked the cluster services so five services were down and these are
Quote: ora_ OCR_DG.DG, ora_fedb96.asm2.asm, ora_fedb96.gsd, ora_fedb96.ons and ora_fedb96.oc4j...
I restarted the services and they were successfully up and application become available . What can be the reason of the service failure?
alert.log
ORA-03113: end-of-file on communication channel Process ID: Session ID: 157 Serial number: 6655 ASMB (ospid: 23903): terminating the instance due to error 15064 Mon Aug 06 02:36:38 2012 NOTE: Deferred communication with ASM instance Errors in file /u01/app/oracle/diag/rdbms/grid12/grid91/trace/grid91_ora_25856.trc: ORA-15055: unable to connect to ASM instance ORA-01092: ORACLE instance terminated. Disconnection forced [code]...