PL/SQL's restriction?

Hi,
This is a syntax question.
How do I define record-typed constants in a package? I need something like this:
Type Color_Type is Record (
red number,
green number,
blue number
COLOR_RED CONSTANT Color_Type := Color_Type(255, 0, 0); -- compile errors here
COLOR_BLUE CONSTANT Color_Type := Color_Type(0, 0, 255);
Is it possible at all to create record constants? Oracle documents just don't say anything about this!!!
Any help is appreciated!

Hi,
This is a syntax question.
How do I define record-typed constants in a package? I need something like this:
Type Color_Type is Record (
red number,
green number,
blue number
COLOR_RED CONSTANT Color_Type := Color_Type(255, 0, 0); -- compile errors here
COLOR_BLUE CONSTANT Color_Type := Color_Type(0, 0, 255);
Is it possible at all to create record constants? Oracle documents just don't say anything about this!!!
Any help is appreciated! #1
Oracle docs say PLENTY about this. Both RECORD and OBJECT types have defined methodologies to be initialized.
http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96624/05_colls.htm#1059
object types: http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/appdev.920/a96624/10_objs.htm#330
#2
You are assigning values to the record variable with incorrect syntax. It doesn't make much sense using RECORD types as variable, and I doubt any elegant scheme could be constructed to use them as so.
-- defined in the database (not just a PL/SQL Block)
CREATE OR REPLACE TYPE color_object_type AS OBJECT (
   red   INTEGER,
   green INTEGER,
   blue  INTEGER );
DECLARE
   COLOR_RED  CONSTANT color_object_type := color_object_type(255,0,0);
   COLOR_BLUE CONSTANT color_object_type := color_object_type(0,0,255);
BEGIN
   NULL;
END;
/Hope that helps.
Michael

Similar Messages

  • NEED SQL SYSTAX RESTRICTION FOR APEX DEVELOPEMENT

    GOOD DAY MASTER..!!!
    I HAVE LITTLE PROBLEM IN SQL.
    I GOT VIEW(ITEMS_IN_SALES2)
    " SELECT INV_NO,
    ITEM_NO,
    ITEM_NAME,
    PRICE,
    QTY_INV,
    NO_SOLD,
    QTY_LEFT
    FROM ITEM_IN_SALES
    WHERE QTY_LEFT > 0;"
    AND IT'S RUNNING FINE..
    THIS IS FOR ME TO GET ALL THE DATA IN INVENTORY(WHERE I GET THE SOURCE OF VIEW)
    IN THIS VIEW ITS POSSIBLE TO COLLECT THE DATA WITH DUPLICATE ITEM_NAME & ITEM_NO BUT DIFFERENCE INV_NO
    AND WHEN I RUN THE VIEW THIS IS THE RESULT
    INV_NO ITEM_NO ITEM_NAME
    1 20 POWDER
    1 21 OIL
    2 20 POWDER
    2 19 BABY OIL
    SEE THE DUPLICATE ITEM_NAME & ITEM_NO BUT DIFFERENCE INV_NO
    WHAT I WANT TO ACHIEVED IS THIS RESULT
    1 20 POWDER
    1 21 OIL
    2 19 BABY OIL
    IS THAT POSIBLE? TO ABLE THE VIEW TO PICK THE ONLY 1ST INV_NO?
    TO PREVENT DUPLICATE
    PLEASE HELP MASTER..
    REGARDS
    MIKE.PILAPIL

    Hi Michael,
    For the above mentioned output,
    You can try something like this,
    SELECT distinct INV_NO,ITEM_NO,ITEM_NAME from invoice where  inv_no not in (2)
    union
    SELECT distinct INV_NO,ITEM_NO,ITEM_NAME from invoice where item_no not in(20) and item_name not in ('POWDER')its only for the output which you mentioned.
    1                      20                   POWDER
    1                      21                   OIL           
    2                      19                   BABY OILThank you.
    Edited by: Gurujothi on May 17, 2012 2:59 AM

  • Updatable Report (MRU) Based on PL/SQL?

    Hi APEX Community,
    I recently started playing with Updateable Reports (MRUs). The functionality seems great but I can’t seem to find a place to write PL/SQL to restrict the records returned.
    Usually I would use code (with report typr PL/SQL function returning SQL query) along the lines of:
    declare
         q varchar2(4000);
         v number;
    begin
         v := :P10_EMP_ID;
         q := 'select
         "PATIENT_ID",
         "EMP_ID",
         "CREATION_DATE",
         "CREATED_BY",
         "LAST_UPDATE_DATE",
         "LAST_UPDATE_BY"
         from PATIENT where "EMP_ID" = '''||v||'''';
         return q;
    end;
    However reports of type Updatable Report only except SQL not PL/SQL.
    This seems to me quite simple functionality, am I missing something??
    Thanks in Advance,
    Immanuel

    Marc: In this simple case, yes, we can easily use standard SQL with bind variables referring to session state.
    But sometimes the table is very large and there are multiple filters needed to select the desired rows. Writing the query like
    select ...
    from t
    where (:P1_FILTER1 is null or filter1=:P1_FILTER1)
    and    (:P1_FILTER2 is null or filter2=:P1_FILTER2)
    and ...make the page very slow to load.
    It would be much more performant to write the query as a PL/SQL function returning SQL query like
    declare
    q long;
    begin
      q := select ... from t where 1=1 ';
      if (:P1_FILTER1 is not null) then
        q := q||' and filter1=:P1_FILTER1';
      end if;
      if (:P1_FILTER2 is not null) then
        q := q||' and filter2=:P1_FILTER2';
      end if;
      return q;
    end;and still be able to use the builtin MRU and Add Rows processes instead of writing our own.
    Maybe this could be an enhancement for 3.0?

  • How to put database in RESTRICTED mode ?

    Hi,
    in 9.2.0.6 on Windows 2003 server how to put database in RESTRICTED mode ?
    Many thanks before.

    ERROR at line 1:
    ORA-12719: operation requires database is in RESTRICTED mode
    That's because 'ALTER SYSTEM QUIESCE RESTRICTED' doesn't actually put the database into restricted mode:
    SQL> select logins, active_state from v$instance;
    LOGINS       ACTIVE_ST
    ALLOWED       NORMAL
    SQL> alter system quiesce restricted;
    System altered.
    SQL> select logins, active_state from v$instance;
    LOGINS       ACTIVE_ST
    ALLOWED       QUIESCEDTry staring the database in restricted mode and then quiescing it:
    SQL>
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup restrict;
    ORACLE instance started.
    Total System Global Area  167772160 bytes
    Fixed Size                  1289508 bytes
    Variable Size             117441244 bytes
    Database Buffers           46137344 bytes
    Redo Buffers                2904064 bytes
    Database mounted.
    Database opened.
    SQL> alter system quiesce restricted;
    System altered.
    SQL> select logins, active_state from v$instance;
    LOGINS           ACTIVE_ST
    RESTRICTED       QUIESCED
    SQL>As you can see from V$INSTANCE, when you are running in restricted mode LOGINS will have a value of 'RESTRICTED'
    However - I still think that if you are dealing with users logging in to your (RESTRICTED) database via the listener then the easiest option is to stop the listener whilst the database is down and restart it once your alter database command has completed.
    PS : No any other user is connected.No, they wouldn't be this time because you had quiesced the database... but you still need to get the database into restricted mode for this alter database command.

  • How to put RAC database in restricted mode?is it with srvctl?

    I know for standalone database its
    SQL> startup restrict --if its down
    SQL> alter system enable restricted session; --if its up
    Any idea for RAC ? any option with srvctl ? what are the steps .....
    Thanks in advance for help
    Gagan

    Hi
    There is no option like that. It's as same as keeping normal database in restricted mode.
    alter database enable restricted session;
    and end with
    alter database disable restricted session.
    Regards,
    Phani Kumar P
    +919948677317

  • SQL Cal licence

    Hi every body.
    I need a new profesional licence for a new user. Do I also buy a new SQL CAL licence or it is enought with the SAP Profesional user licence ?

    Dear Tornel,
    Here is what I've got from partner portal about SQL cal license and SQL licensing for B1 :
    MS SQL SERVER LICENSING ESSENTIALS FOR SAP BUSINESS ONE
    Introduction
    With this document, SAP wants to provide you with clear guidelines regarding the Microsoft SQL Licensing structures relating to SAP Business One.
    The full and detailed SQL Server restrictions are included in the SAP Business One pricelist in the additional provisions. These provisions are the legal restrictions which apply to the SQL Server license purchased from SAP.
    Although a lot of attention has been put into this document, no rights can be derived from this document and the 'conditions for Use of Microsoft SQL Server when licensed from SAP' is the only document that describes the terms and conditions that apply.
    Content of this document:
    Run-time license
    Run-time license restrictions
    Run-time license and data reporting guidelines
    What is the difference between Client Access License (CAL) and Per CPU licensing
    How to determine my SQL Server licensing for SAP Business One?
    Frequently Asked Questions
    Practical examples of complex network environments
    Back to Top
    Run-time license
    SAP Business One supports the Microsoft SQL Server database system. SAP offers a run-time license of Microsoft SQL Server as an optional service to its customers. Using the run-time restricted SQL Server licensing is not mandatory for SAP Business One. The end-customer has to ensure proper licensing for SQL Server which can also be done with an SQL Server license purchased from a Microsoft partner (Commercial license).
    When a Microsoft SQL Server license is purchased from SAP, a run-time restricted license of MS-SQL Server 2005 'Standard edition' is licensed. The 'run-time' restricted license has additional restrictions in use compared to the commercial MS-SQL Server 2005 Standard Edition licenses. Please note that a customer do not have to purchase SQL licenses from SAP in any instance. SAP resells the SQL licenses as a convenience for partners and customers.
    A commercial SQL license cannot be purchased from SAP, but need to be purchased from a Microsoft Reseller.
    Back to Top
    Run-time license restrictions
    A run-time restricted license of MS-SQL Server purchased via SAP is a license which can only be used in combination with the SAP Business One Software. This means that the license cannot be used in combination with other software products. In general the restrictions are:
    The SQL Server run time license cannot be used to develop new software applications.
    Customers or Partners who are developing new applications /add-on's (for example using SAP Business One Software Development Kit) cannot use the runtime license of SQL Server. Developers have to use the commercial versions or development license of Microsoft.
    The SQL Server run-time license cannot be used in conjunction with any software application, databases or tables other then the SAP Business One application except for add-ons developed with the SDK.
    For example, when a third party application is running outside the SAP Business One environment at the customer's, for example a specific time-registration application or some 'own developed' system, the runtime license cannot be used.
    Partner add-ons developed with the SAP Business One Software Development Kit can be used with SAP Business One running on a run-time restricted license of SQL Server.
    The SQL Server run-time license cannot be used as a 'stand-alone' software application.
    Back to Top
    Run-time licenses and data reporting
    It is allowed to use a reporting tool to run queries or reports from existing tables in the SAP Business One databases.
    Using for example Excel / Crystal Reports or any other reporting tool to connect directly to the SAP Business One database is allowed as long as it is used for reporting purposes only subject to a valid run-time restricted MS SQL Server license.
    Back to Top
    What is the difference between a 'per CPU' and a CAL license?
    Per CPU licensing
    A 'Per CPU' license can be used to license an SQL Server installation on a server and link the license to a single processor. In case a server has 2 CPU's and both CPU's will be linked to SQL Server, 2 'Per CPU' licenses are required. Within the SQL Server management console you can select how many of the CPU's in the server will be used. For a 'per CPU' license it does not matter how many users connect to the SQL Server.
    Back to Top
    Client Access Licensing (CAL)
    The CAL licensing allows you to install SQL Server to one SQL Server and assign the license to that server. Within this installation it is allowed to run as many instances as you need.
    The number of logins is determining the number of SQL CAL licenses. A login user is a network user that accesses SAP Business One. A login user can have one or more user licenses assigned. For example; User A has a limited logistics and a limited financial user license assigned to the same login username. In this case there is one login user who only needs one CAL even though the number of SAP user licenses is different.
    Please note that when the license of the SAP user licenses changes this might have an effect on the required CAL licenses and additional CAL licenses have to be purchased. To avoid licensing errors, SAP strongly advices to keep the number of CAL licenses equal to the maximum number of user licenses in SAP Business One.
    The CAL licenses are per user and cannot be used for concurrent connections.
    Back to Top
    When is a 'Per CPU' license mandatory?
    A 'per CPU' license in mandatory if you cannot determine how many users will connect directly or indirectly to the SQL Server. For example, when an internet Web shop is linked to an SQL Server database, the number of web users cannot be determined and a 'per CPU" license is required. This also applies to other (internal) Web based solutions where the number of users connection cannot be controlled.
    For SAP Business One a 'per CPU' license is mandatory for:
    the e-Commerce server
    The DI-Server if the number of users connecting to the DI-Server based add-ons cannot be determined.
    Please note that a valid 'per CPU' license is required. This does not mean that the license has to be purchased from SAP.
    Back to Top
    How to determine my SQL Server licensing for SAP Business One?
    When you determine the SQL Server licensing you have to ensure that all servers running SQL Server are licensed. See also FAQ's
    If you already have a valid SQL Server license or purchased such from other suppliers, you do not need to purchase an SQL Server license from SAP.
    Ensure the Licensed version SQL Server is supported by SAP
    Ensure the license is not another 'run-time' restricted license from another software vendor
    Ensure the license has enough CAL / 'per CPU' licenses available to also be used with SAP Business One.
    Do you purchase the e-Commerce server?
    The e-Commerce server always requires a valid 'per CPU' license for MS-SQL Server for each CPU used by MS-SQL Server. The 'per CPU' license can be a 'run-time' restricted license from SAP or a commercial license from a Microsoft partner.
    Please note that every server where SQL Server is installed requires proper licensing. If the e-Commerce server uses a different SQL Server as SAP Business One, both servers have to be licensed. In this case the e-Commerce server can have a 'per CPU' license where as the SQL Server for SAP Business One could run on a CAL or CPU licensing.
    Which SQL Server license do you need when you purchase the DI-Server?
    If you already have a 'Per CPU' license available you do not need an additional 'Per CPU' SQL Server license providing the existing licensed SQL Server is used.
    Can you determine the number of named users accessing the DI-Server through the add-ons?
    No >> you should license SQL Server 'per CPU'
    Yes >> a 'per CPU' license is not mandatory but depending on the number of logins it might be cost effective. Every user has to have a CAL.
    When in doubt, SAP strongly advices to use 'per CPU' licensing for the DI-Server.
    Client Access License (CAL) License
    You do not need a CAL license if you already have valid 'Per CPU' license available for the specified SQL Server.
    You need one CAL SQL Server license for each login in SAP Business One.
    Example 1: a license with 4 Professional users and 1 Limited CRM, 1 logistics users and 1 limited financial user is in total 7 users in SAP Business One. If the licenses are assigned to also 7 logins then you would need 7 CAL licenses.
    In case the 1 limited financial user and 1 limited logistics license has been assigned to one login (1 user can have multiple licenses assigned), then you would only need 6 CAL licenses.
    Back to Top
    Below you can find a flowchart that could assist you to chose between 'per seat' or 'per CPU' licensing.
    here is a link for more detail:
    https://websmp203.sap-ag.de/%7Esapidb/011000358700000705282008E
    Rgds,

  • Restricted session & Kill Session

    Hello everybody,
    1) In which case do I need enabled restricted sessions?
    2)Where “ALTER SYSTEM KILL SESSION” command will be useful?
    Thanks in advance

    Salman Qureshi wrote:
    Hi,
    1) In which case do I need enabled restricted sessions?Whenever you want to perform some maintenance operations in your database and you don't want anyone to access the database except user SYS, you can enable restricted session.
    2)Where “ALTER SYSTEM KILL SESSION” command will be useful?When you want to kill a session which is no longer responding or hung or doing some long running operation which is disturbing your performance or you want to stop that processing etc.
    SalmanHi Salman,
    I think you'll find that "restricted session mode" does not limit login ability to only the SYS user as you mention.
    As an example, consider the following.
    Session 1:
    SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 1 22:07:03 2013
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    SQL> connect / as sysdba
    Connected.
    SQL> shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    SQL> startup restrict;
    ORACLE instance started.
    Total System Global Area 2137886720 bytes
    Fixed Size                  2256912 bytes
    Variable Size            1258295280 bytes
    Database Buffers          872415232 bytes
    Redo Buffers                4919296 bytes
    Database mounted.
    Database opened.
    SQL>Session 2:
    SQL*Plus: Release 11.2.0.3.0 Production on Tue Jan 1 22:07:51 2013
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    SQL> connect markwill
    Enter password:
    Connected.
    SQL> select logins from v$instance;
    LOGINS
    RESTRICTED
    1 row selected.
    SQL>As you can see in Session 2 I am clearly not connecting as SYS user, yet I am capable of connecting to an instance started in restricted mode.
    Rather than limiting to only user SYS it limits login ability to users with the RESTRICTED SESSION System Privilege (granted directly or via role).
    Regards,
    Mark

  • Error in running adstats.sql after applying patch 6810189 on 10.2.0.2

    following error faced when run the script adstats.sql through sys user after starting the database with restrict option:
    SQL> @/backup/adstats.sql;
    Connected.
    --- adstats.sql started at 2010-09-13 21:44:26 ---
    Checking for the DB version and collecting statistics ...
    declare
    ERROR at line 1:
    ORA-12801: error signaled in parallel query server P002
    ORA-25153: Temporary Tablespace is Empty
    ORA-06512: at "SYS.DBMS_STATS", line 13591
    ORA-06512: at "SYS.DBMS_STATS", line 13937
    ORA-06512: at "SYS.DBMS_STATS", line 14015
    ORA-06512: at "SYS.DBMS_STATS", line 13974
    ORA-06512: at line 2
    ORA-06512: at line 33
    Can anyone help?
    Thanks in advance,
    Umair

    Hi,
    I made the changings as follows:
    SQL> alter database default temporary tablespace temp2;
    Database altered
    But I got new error as such after starting the database in restricted mode:
    $ sqlplus sys as sysdba
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 15 11:22:49 2010
    Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
    Enter password:
    Connected to an idle instance.
    SQL> startup restrict;
    ORACLE instance started.
    Total System Global Area 1073741824 bytes
    Fixed Size 2089440 bytes
    Variable Size 427822624 bytes
    Database Buffers 629145600 bytes
    Redo Buffers 14684160 bytes
    Database mounted.
    Database opened.
    SQL>@adstats.sql;
    ERROR:
    ORA_01031: insufficient priviliges
    $ pwd
    /proddb
    $ ls -l ad*
    -rwxr-xr-x 1 oracle dba 2763 Sep 15 11:16 adstats.sql
    $ id
    uid=203(oracle) gid=204(dba)
    $
    Can anyone suggest about the reason?
    Thanks & Regards,
    Umair

  • For running utlrp.sql need users termination from the database?

    Hai All,
    My database jobs terminated in some time. So I want to run utlrp.sql for compiling all invalid objects. Is It needs users termination from the database? or login to restricted session? Please give a correct step for doing this activity..
    Please help?
    Shiju

    database? or login to restricted session? Please
    give a correct step for doing this activity..
    It is good , if you run utlrp.sql in restricted mode also set job_queue_processes =0 and check no dbms_job running package ( if package is valid then fine ). Problem only come when package/procedure are locked/in use by session. If invalid package are not used by any session then you can run utlrp.sql without restricted mode also. Well you know better you application.
    Since you not altering any dependencies, just want to compile , you can run without restricted mode.
    Virag

  • Utlrip.sql stops at DROP TABLE UTLUP_TEMP due to deadlock detected in 9i

    running utlrip.sql in 9i
    utlrip.sql
    it stops here
    SQL> DROP TABLE UTLIP_TEMP;
    DROP TABLE UTLIP_TEMP
    ERROR at line 1:
    ORA-04020: deadlock detected while trying to lock object
    SYS.CDC_ALTER_CTABLE_BEFORE
    even after bouncing the 9i db it gets the same error.
    not sure what to do, is it re-runnable?
    or should I go on to to utlrp.sql?

    Update: Oracle support had the soln...
    As your update, you met the ORA-04020 error on 9i when running utlrp.sql.
    Please, run like below.
    1. shutdown database
    2.
    Set the following in the INIT.ORA
    systemtrig_enabled=false
    aq_tm_processes=0
    job_queue_processes=0
    (After creating and running these scripts and the database is ok then restart the database with the parameters taken out of the init.ora.)
    3. Restart the database with restrict mode and rerun utlrp.sql.
    SQL> startup restrict
    SQL>@?/rdbms/admin/utlrp.sql
    OR
    As an Alternative, if your application is not using CDC, we can disable these triggers as follows:
    SQL> conn / as sysdba
    SQL> ALTER TRIGGER sys.cdc_alter_ctable_before DISABLE;
    SQL> ALTER TRIGGER sys.cdc_create_ctable_after DISABLE;
    SQL> ALTER TRIGGER sys.cdc_create_ctable_before DISABLE;
    SQL> ALTER TRIGGER sys.cdc_drop_ctable_before DISABLE;
    This will also prevent the deadlock from occurring.
    --- also
    I found out through another metalink note which queries we were using, and
    we apparently aren't using CDC, don't know why those trigers were in our instance.
    thaks

  • SAP R/3 Tables without Date fields

    I am trying to import data from SAP R/3 into MS SQL DWH.
    There are tables which doesnot have posting date fields.
    Can anyone tell me how to map them with those Table which will have posting date fields, so i can create view in SAP and then pull that view into SQL DWH restricting on date.
    Following tables which doesnot have date fields i want to pull date for month of July 2007;
    EKBE
    EKKO
    MAKT
    MSEG
    KSEG
    AFPO
    JEST
    JCDS
    MARA
    AUFK
    COEP
    RESB
    MARC
    I am not a ABAP developer just trying to get my data from SAP, so please answer in detail.

    BUDAT is the technical name for Posting Date field. This field is used many DB Tables/ Strucutres. Using where used option you can find the required tables.
    I suggest you to look at BSEG table for Finace Document postings by Posting Date.

  • Error on auto execute of job 1032656.. Where i can get the details?

    ORA-12012: error on auto execute of job 1032656
    ORA-04063: ORA-04063: package body "ORACLE_OCM.MGMT_DB_LL_METRICS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: "ORACLE_OCM.MGMT_DB_LL_METRICS"
    ORA-06512: at line 1
    ORA-1580 signalled during: alter database backup controlfile to 'backup_control_file.ctl'..
    Hi All,
    I am getting the above error in my alert log.
    When i check in my dba_jobs there were only two jobs having job column 1 & 21.
    Where i can see the job 1032656 and its details ?
    Regards
    Arun

    Hi Arun,
    This is due to invalid objects in ORACLE_OCM schema.
    Please read metalink note id:
    Invalid Objects After Revoking EXECUTE Privilege From PUBLIC [ID 797706.1]
    Symptoms
    OEM recommends that EXECUTE privilege being revoked from PUBLIC. After revoking the privilege, the following errors appeared in alert log:
    ORA-12012: error on auto execute of job 66171
    ORA-04063: package body "ORACLE_OCM.MGMT_DB_LL_METRICS" has errors
    ORA-06508: PL/SQL: could not find program unit being called: ORACLE_OCM.MGMT_DB_LL_METRICS"
    ORA-06512: at line 1 has errors .
    Also, the below query returns invalid rows count (approximately 46 rows)
    SQL> select object_name, owner, object_type, status from dba_objects where status = 'INVALID';
    Owners of invalid objects are ORACLE_OCM and WMSYS
    *Cause*
    At the time of installation of the database, Oracle execute scripts that test to see if PUBLIC access is granted to all of the routines that ORACLE_OCM and WMSYS need access to. If PUBLIC access is NOT available, Oracle scripts grant specific access rights. However, If EXECUTE privilege is revoked from PUBLIC after installation, then those specific access rights needs to be granted manually.
    *Solution*
    You will need to grant execute on UTL_FILE and DBMS_SCHEDULER to ORACLE_OCM and WMSYS. The below action plan should solve the issue:
    SQL> grant execute on UTL_FILE to oracle_ocm;
    SQL> grant execute on DBMS_SCHEDULER to oracle_ocm;
    SQL> grant execute on UTL_FILE to wmsys;
    SQL> grant execute on DBMS_SCHEDULER to wmsys;
    SQL> shutdown immediate;
    SQL> startup restrict;
    SQL> @utlrp.sql /* $ORACLE_HOME/rdbms/admin/@utlrp.sql */
    SQL> shutdown immediate;
    SQL> startup;
    Regards
    Rajesh

  • Controlfile has corrupted and not able to open up the database. Very urgent

    Hi All,
    I am working on 11gR1 database on linux environment and suddenly the DB went down. I look at the alert log and i am following that guidelines, but i am not able to put the database in mount state and it is thronging error message. Please suggest me in correct way. This is very high priority for me.
    I have done below steps.
    1.set the environment through . oraenv
    2. export ORACLE_SID
    3. SQL>startup nomount
    ORACLE instance started.
    Total System Global Area 4943876096 bytes
    Fixed Size 2143944 bytes
    Variable Size 2617248056 bytes
    Database Buffers 2281701376 bytes
    Redo Buffers 42782720 bytes
    SQL>alter database mount;
    alter database mount
    ERROR at line 1:
    ORA-00214: control file '/u02/oradata/beacondp/control02.ctl' version 390158 inconsistent with file '/u01/oradata/beacondp/control01.ctl' version 390097
    4. SQL>alter system set control_files='/u02/oradata/beacondp/control03.ctl' scope=spfile;
    System altered.
    SQL>startup restrict
    ORA-01081: cannot start already-running ORACLE - shut it down first
    5. SQL>alter database mount;
    alter database mount
    ERROR at line 1:
    ORA-00214: control file '/u02/oradata/beacondp/control02.ctl' version 390158 inconsistent with file '/u01/oradata/beacondp/control01.ctl' version 390097
    alert log Information:
    Thread 1 advanced to log sequence 9261
    Current log# 3 seq# 9261 mem# 0: /u02/oradata/beacondp/redo03.log
    Tue Sep 13 15:00:14 2011
    ********************* ATTENTION: ********************
    The controlfile header block returned by the OS
    has a sequence number that is too old.
    The controlfile might be corrupted.
    PLEASE DO NOT ATTEMPT TO START UP THE INSTANCE
    without following the steps below.
    RE-STARTING THE INSTANCE CAN CAUSE SERIOUS DAMAGE
    TO THE DATABASE, if the controlfile is truly corrupted.
    In order to re-start the instance safely,
    please do the following:
    (1) Save all copies of the controlfile for later
    analysis and contact your OS vendor and Oracle support.
    (2) Mount the instance and issue:
    ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
    (3) Unmount the instance.
    (4) Use the script in the trace file to
    RE-CREATE THE CONTROLFILE and open the database.
    Please let me know, how i need to proceed. Major problem is i am not able to put the db in mount state. I have both spfile and pfile.
    Thanks in advance.

    user13162661 wrote:
    Thanks Pavan for yoour response, but how can i find, which is good copy of the controlfile?
    Now i have 3 controlfiles in spfile or in pfile, Can i directly remove the 1 and 2 controlfiles from pfile and put the 3rd there itself and start the db.
    startup pfile='file_path';
    Is there any thing i am missing?
    Please helpout.
    control file '/u02/oradata/beacondp/control02.ctl' version 390158 inconsistent with file '/u01/oradata/beacondp/control01.ctl' version 390097I suspect that control02.ctl is the good one since it has the higher SCN

  • Track documents based on a purchase order

    Hi,
    One of my customers asked me yesterday if there is a good way to follow the steps from a purchase order to goods reciept and AP invoice? If you have a large purchase order with many items and only a few of them are copied to goods reciept PO at a time, and you have several goods reciepts PO and many invoices. How can one best track all of these documents and get a good overview?
    I tried using Drag & Relate, but it's not good enough to get the whole picture. So I would really appreciate if you have some tips, or if there could be a way to create a report for which documents are based on a purchase order.
    Best regards,
    Lena-Marie

    Hello Lena-Marie - welcome to the forum.  You might want to start with this and add some more into and/or change the WHERE clause to pull up the information you need.   Such as T2.DocNum =
    This SQL was restricted to display only some open items...
    If you need more help changing this particular SQL, just contact me directly through my business card's alternative...
    Regards - Zal
    --E-PU Audit Review of Purchase Orders to AP Invoices Workstation Ver 1 ZP 2011 02 14
    --DESCRIPTION:  SQL shows ONLY those lines from the Purchase Orders or Goods Receipts or AP Invoice that are still open and needing to be worked.
    --AUTHOR(s):
    --Version 1 Zal Parchem 14 Feb 2011
    SELECT
    T2.DocNum AS 'Purch Ord',
    T2.DocDate AS ' Ord Date',
    T1.ShipDate AS 'Expected',
    T1.ItemCode AS 'Product',
    CASE
    WHEN T1.[LineStatus] = 'O' THEN 'Open'
    WHEN T1.LineStatus = 'C' THEN 'Closed'
    ELSE 'Error'
    END AS 'Row Stat',
    CASE
    WHEN T2.Canceled = 'Y'
    THEN 'Yes'
    ELSE ' '
    END AS 'Cancelled?',
    T1.LineNum+1 AS 'Line',
    T1.Quantity,
    T1.OpenQty AS 'Open Qty',
    T4.DocNum AS 'Goods Rcpt',
    T4.DocDueDate AS 'Rcpt Date',
    CASE
    WHEN T3.[LineStatus] = 'O' THEN 'Open'
    WHEN T3.LineStatus = 'C' THEN 'Closed'
    ELSE ' '
    END AS 'Row Stat',
    CASE
    WHEN T4.Canceled = 'Y'
    THEN 'Yes'
    ELSE ' '
    END AS 'Cancelled?',
    T3.LineNum + 1 AS 'Line',
    T3.Quantity,
    T6.DocNum AS 'Return',
    T5.LineNum +1 AS 'Line',
    CASE
    WHEN T5.[LineStatus] = 'O' THEN 'Open'
    WHEN T5.LineStatus = 'C' THEN 'Closed'
    ELSE ' '
    END AS 'Row Stat',
    CASE
    WHEN T6.Canceled = 'Y'
    THEN 'Yes'
    ELSE ' '
    END AS 'Cancelled?',
    T5.Quantity,
    T8.DocNum AS 'AP Invoice',
    T7.LineNum + 1 AS 'Line',
    T7.Quantity,
    T10.DocNum AS 'AP Cred Memo',
    T9.LineNum + 1 AS 'Line',
    T9.Quantity
    FROM POR1 T1
    LEFT OUTER JOIN OPOR T2
    ON T1.DocEntry = T2.DocEntry
    LEFT OUTER JOIN PDN1 T3
    ON T2.DocEntry = T3.BaseEntry
    AND T1.LineNum = T3.BaseLine
    AND T1.ItemCode = T3.ItemCode
    LEFT OUTER JOIN OPDN T4
    ON T3.DocEntry = T4.DocEntry
    LEFT OUTER JOIN RPD1 T5
    ON T4.DocEntry = T5.BaseEntry
    AND T3.LineNum = T5.BaseLine
    AND T3.ItemCode = T5.ItemCode
    LEFT OUTER JOIN ORPD T6
    ON T5.DocEntry = T6.DocEntry
    LEFT OUTER JOIN PCH1 T7
    ON T4.DocEntry = T7.BaseEntry
    AND T3.LineNum = T7.BaseLine
    AND T3.ItemCode = T7.ItemCode
    LEFT OUTER JOIN OPCH T8
    ON T7.DocEntry = T8.DocEntry
    LEFT OUTER JOIN RPC1 T9
    ON T8.DocEntry = T9.BaseEntry
    AND T7.LineNum = T9.BaseLine
    AND T7.ItemCode = T9.ItemCode
    LEFT OUTER JOIN ORPC T10
    ON T9.DocEntry = T10.DocEntry
    WHERE
    (T1.LineStatus = 'O' OR T3.LineStatus = 'O' OR T5.LineStatus = 'O')
    ORDER BY
    T2.DocNum,
    T1.LineNum,
    T4.DocNum,
    T3.LineNum,
    T6.DocNum,
    T5.LineNum,
    T8.DocNum,
    T7.LineNum,
    T10.DocNum,
    T9.LineNum
    FOR BROWSE

  • ORACLE XE ora-12514 error

    Hi all,
    I have installed the oracle xe in my windows xp machine. for some reason i have shut down the oracle and given "startup restrict" mode, but it is thrown the below mentioned error
    "SQL> startup restrict;
    ORA-12514: TNS:listener does not currently know of service requested in connect
    descriptor"
    please help me.
    Thanks

    The reason why this error shows is because oracle is self-registered against listener, so when it shuts down the listener deregisters the instance and any further attempt to contact it will result in an ORA-12514 error.
    Once the instance is restarted it will contact again the listener and will registers against it once more. This process will take no more than 60 seconds, but you can force it by issuing the command:
    ALTER SYSTEM REGISTER;
    ~ Madrid

Maybe you are looking for

  • I am trying to request a repair for my ipod

    I am trying to request a repair for my ipod which is under warrantee. I go through the process but part way through I get a popup error message saying something like "contact customer support" and then it has a bunch of numbers. I tried doing it agai

  • Zoom in on Images

    Flash 8 Trial Mode, XP-P, Kinda new to Flash, too. I'm using the template Modern Photo Slideshow that came with the trial version. Its default stage is 640 x 480, which I need to change to 320 x 240. I know how to do that, but once I do that, does it

  • Problem while sending Abap list to mail

    Hi All, I am sending an abap list to mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1. Report output is going to mail id but only last page is showing. The flow i followed in the code is as follows: First I used Function module SAVE_LIST Next

  • How do you eject a CD stuck in the drive from an imac that won't start?

    My Imac won't start. Its stuck on the Apple screen with the little gear going around. Other discussion have suggesting trying to boot directly from the install disc, which I want to try but can't because when it crashed there was a DVD in the optical

  • XI 7.0 Flat File FTP Transfer

    We have an ERP 2005-NetWeaver system installed and in process.  In the XI(now called PI) we have it set up properly checked x3 by 2 different people and the SM and SLD up and configured.  Our first Business Scenario was to pull an iDoc from ERP 2005