TABLE_LOCK IN USER_TABLES

Hi,
what is the use of column "TABLE_LOCK" in
User_tables/All_tables ...
any significant in this...can we identify which table has got locked with this one.
Regards,
Sriram

I found this in the documentation:
TABLE_LOCK VARCHAR2(8) Whether table locking is enabled or disabledLocking can be done explicitely like this:
SQL> lock table lb in exclusive mode;
Table(s) Locked.If you want to prevent this explicite locking from taking place, you can do:
SQL> alter table lb disable table lock;
Table altered.
SQL> select table_name, table_lock from user_tables;
TABLE_NAME                     TABLE_LO
LB                             DISABLED
LB_MV                          ENABLED
LB_STAGE                       ENABLED
MLOG$_LB                       ENABLED
MSSA_SALES                     ENABLED
RUPD$_LB                       ENABLED
6 rows selected.
SQL> lock table lb in exclusive mode;
lock table lb in exclusive mode
ERROR at line 1:
ORA-00069: cannot acquire lock -- table locks disabled for LB
SQL>L.

Similar Messages

  • Pls help : How To select fields and data from user_table for each tablename

    Please help with the query to generate a output which selects the code,meaning,inuse for each table in the user_table that has "CODED" as a part of table name.
    User table has some 800 table that contains CODED in the tablename.
    Desc of the table:
    DESCPTION:
    Name Null? Type
    SHORT_NAME NOT NULL VARCHAR2(20)
    CODE NOT NULL VARCHAR2(4)
    MEANING NOT NULL VARCHAR2(240)
    IN_USE VARCHAR2(1)
    NOTES VARCHAR2(2000
    UNITS NOT NULL VARCHAR2(1)
    AMOUNT NOT NULL VARCHAR2(3)
    CONVERTED VARCHAR2(1)
    RUN_NAME VARCHAR2(30)
    But all the table have code, meaning,in_use fields.
    O/P format :
    TABLE_NAME CODE MEANING IN_USE
    Help me pls.

    Not 100% sure what you want. If you want to see all the tables that have all three of those columns, then you could do something like:
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'CODE' and
          table_name like '%CODED%'
    INTERSECT
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'MEANING' and
          table_name like '%CODED%'
    INTERSECT
    SELECT table_name, 'CODE', 'MEANING', 'IN_USE'
    FROM user_tab_columns
    WHERE column_name = 'INUSE' and
          table_name like '%CODED%'If you want to select those three columns from each of the tables, then you could do something like this.
    Create a command file called, for example, makesel.sql that looks like:
    SET PAGES 0 lines 500 trimspool on feedback off;
    spool sel.sql;
    prompt spool selout.txt;
    SELECT 'SELECT '''||table_name||''', code, meaning, in_use FROM '||
           table_name||';'
    FROM (SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'CODE' and
                table_name like '%CODED%'
          INTERSECT
          SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'MEANING' and
                table_name like '%CODED%'
          INTERSECT
          SELECT table_name
          FROM user_tab_columns
          WHERE column_name = 'INUSE' and
                table_name like '%CODED%')
    prompt 'spool off;'
    spool off;
    @sel.sqlAt the sqlplus prompt run the file using @makesel.sql. This will create another file called sel.sql containing the commands to select those three columns from each table that has all three columns, then after the new file is created, it runs the file (@sel.sql). The output will be spooled to a file called selout.txt.
    HTH
    John

  • Accessing user_tables and user_tab_columns of oracle from java

    hi, i can not access "user_tables" and "user_tab_columns" from java code while i can access them from TOAD.I connect to the database "HR", which is a sample database of oracle, as "normal".When i write:
    @Entity
    @Table(name="user_tab_columns")
    public class USER_TAB_COLUMNS{
    }it gives an error that user_tab_columns could not be found on the database.What can i do to access these tables from code?

    I think you have posted your question in the wrong forum. Try the [JDBC forum|http://forums.sun.com/forum.jspa?forumID=48].

  • Accessing user_tables from sys

    Hi,
    I want to access the user_tables of schema scott from sys. I am using 10gR2 on Solaris. Actually I want to check the last_analyzed and row_num columns of that schema but doesn't know the password of scott and dont want to alter it.
    regards

    Alsol, you can keep the current "SCOTT" user's password encripted, change it and restore it after you're done:
    SELECT PASSWORD from DBA_USERS where USERNAME='SCOTT';
    (Last query, will give you the encripted password of the user)
    alter user SCOTT IDENTIFIED by MYNEWPASS;
    sqlplus SCOTT/MYNEWPASS;
    whathever you have to do... and quit
    ALTER USER SCOTT IDENTIFIED BY VALUES 'THE_OLD_ENCRIPTED_PASSWORD';
    Regards,
    Enric Moya

  • Count all rows in user_tables

    Hi,
    Any one could help me to write a pl/sql procedure to get the total number of all the rows of user_tables?
    Thanks!

    Have a look at the following thread:
    'count rows of all rows of all tables urgent'
    count rows of all rows of all tables urgent

  • USER_TABLES view select problem

    i have created a new user and created a test table using USERS tablespace with unlimited quota, ive dont grant select on user_tables to username;
    i have created test table and selecting * from user_tables shows the table but selecting where returns no rows???
    can anyone see a problem here?
    SQL> SELECT TABLE_NAME,
    2 NUM_ROWS,
    3 BLOCKS ,
    4 EMPTY_BLOCKS,
    5 AVG_SPACE ,
    6 CHAIN_CNT ,
    7 AVG_ROW_LEN
    8 FROM user_tables
    9 WHERE table_name = 'test';
    no rows selected
    SQL> SELECT TABLE_NAME,
    2 NUM_ROWS,
    3 BLOCKS ,
    4 EMPTY_BLOCKS,
    5 AVG_SPACE ,
    6 CHAIN_CNT ,
    7 AVG_ROW_LEN
    8 FROM user_tables;
    TABLE_NAME NUM_ROWS BLOCKS EMPTY_BLOCKS AVG_SPACE
    CHAIN_CNT AVG_ROW_LEN
    TEST
    SQL>

    Are you serious? This is EXACTLY the same isue that ypou had ORACLE USER_TABLES Table names in CAPITALS.

  • USER_TABLES report

    I am trying to create a simple SQL report on USER_TABLES but all I get is a ORA-01403: no data found error.
    The query is SELECT * FROM USER_TABLES where table_name like 'OCA%'
    Please assist.
    Robert

    Never mind. I found my problem The error was not related to the report but to page 0.
    Robert

  • Should user_table be used in stored procedure.

    Hi,
    i want to find my permanent table in user_tables and then drop and recreate it,
    can i use this user_tables in my stored procedure for above purpose or is there any view which should be used.
    sp is admin sp , used to run offline.
    yorus sincerely
    Edited by: 944768 on Feb 10, 2013 11:44 PM
    Edited by: 944768 on Feb 10, 2013 11:44 PM

    >
    the stored proc is run by single purson to do some admin job and data transfer job offline.
    so it checks the existence of table if it exists it drops it then create it, the need was related to release of that Stored proc.
    in reality there is not need it can be handeled.
    but i wanted to know that can i use user_table in above stored proc to find the existence and then drop and create it when everit runs ?
    >
    No - an admin user cannot use the USER_TABLES view to see tables owned by a different user. The would need to use the ALL_TABLES or DBA_TABLES view and specify the OWNER in the query.
    See ALL_TABLES in the Database Reference
    http://docs.oracle.com/cd/B28359_01/server.111/b28320/statviews_2105.htm#i1592091
    The bigger problem you will have is that dropping the table may cause other objects and code to become invalid and break other processes. Those components would need to be recompiled.
    Another issue is: where will you get the DDL to recreate the table?
    One source is to use DBMS_METADATA.GET_XML to get the DDL before you drop the table and then submit that XML using the same package to recreate the table.
    But doing all of that dynamically (get DDL, drop the table, find/recompile the invalid objects, recreate the table) is very risky and likely to cause errors. And because the process is dynamic you cannot find or fix problems easily so it needs to be bullet-proof.
    The time and resources it would take to do the job properly will be excessive compared to just creating scripts to run manually.
    Your approach is NOT recommended.

  • Are there permissions required to delete table_names in user_tables

    i have  written  a stored procedure in it there is a line
    "Delete from User_tables where TABLE_NAME like v_TableName;" this query deletes contents in TABLE_NAME column of USER_TABLES in DATABASE
    but when i executed it it is showing ERROR  ": ORA-01031: insufficient privileges" i have seen session privileges but it is having CREATE PROCEDURE,CREATE ANY PROCEDURE,DELETE ANY TABLE
    priveleges what could be the problem

    user_tables is a view on the datadictionary. The datadictionary is maintained by DDL commands, like CREATE TABLE, DROP TABLE, etc.
    In other words: you are on the wrong track.
    You can not delete from any datadictionary view.
    You need to use
    EXECUTE IMMEDIATE 'DROP TABLE '||table_name;
    And dropping tables through PL/SQL is also a very bad idea.
    Sybrand BAkker
    Senior Oracle DBA

  • Select performance from all_tables vs user_tables (same for columns)

    Hi, I need to run two queries, one is to select either all tables of a specific owner, the other query is to select all columns of that owner.
    Sometimes the owner is the user I connected as, and sometimes its different.
    I was wondering what the performance implication is of running:
    select ... from all_tables where owner = 'my owner';
    vs
    select ... from user_tables;
    I realize I can only do this if 'my owner' is the connected user, but if there is a performance difference, I'd rather put the 'if/else' code in there to get faster results.
    Same question for all_tab_columns vs. user_tab_columns.
    I ran a test locally here (development shop), and don't see performance difference, but I am not sure how it would work out in production database.
    If version of Oracle matters, I'm interested in Oracle 10g and above. (nothing below 10g)
    Edited by: user5947840 on Aug 25, 2011 6:30 AM

    Not really of any consequence so far as you are concerned. ALL_ and USER_ are both the same catalog queries underneath - the difference being that USER_ filters on the current user, but ALL_ filters on the privileges of the current user.

  • Record counts of the tables in USER_TABLES

    Hello everyone.
    Please give me advice, is it possible to enumerate the tables in the USER_TABLES and in the same time to retrieve the record count in every each of them?
    To illustrate, I want something like that:
    select t.table_name,(select count(*) from t.table_name) from USER_TABLES t
    This is only for isllustration. I know that is not the way.
    Thank you in advance for your answers.

    Code could be compacted down a little...
    SQL> set serveroutput on
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    cursor cur_table_count is
      3      select table_name from user_tables order by table_name;
      4    v_cnt number;
      5  begin
      6    dbms_output.put_line('Table Name                     Record Count');
      7    dbms_output.put_line('============================== ============');
      8    for t in cur_table_count
      9    loop
    10      execute immediate 'select count(*) from '||t.table_name into v_cnt;
    11      dbms_output.put_line(RPAD(t.table_name,31)||v_cnt);
    12    end loop;
    13* end;
    SQL> /
    Table Name                     Record Count
    ============================== ============
    BONUS                          0
    DEPT                           4
    EMP                            14
    SALGRADE                       5
    PL/SQL procedure successfully completed.

  • 2x cursor: 1x user_tables + 1 x tab_cols

    Hi guys,
    I was just wondering whether it is possible to dynamicaly get all user tables then all user columns and write all content to a file.
    What I am trying to do is export all the tables listed in user_tables.
    I have got the loop already for the user_tables and the loop for the user_columns too,
    but then I need to get the column name dynamically and then something like this doesn't work:
    OPEN the_cursor_table FOR 'select * from '|| utables.table_name;
    LOOP
    table_name := utables.table_name;
    * FETCH the_cursor_table INTO table_name%rowtype;
    EXIT WHEN the_cursor_table%NOTFOUND;
    It is not working on the line with an astrix, how can this be fixed?
    4Eyes

    cant you generate a script like this. if you want you can make changes and add extra commas so that you can spool it to CSV.
    SQL> WITH my_user_tables AS
      2       ( SELECT 'test1' AS tab_name, 'user1' AS user_name
      3          FROM DUAL
      4        UNION ALL
      5        SELECT 'test2' AS tab_name, 'user1' AS user_name
      6          FROM DUAL
      7        UNION ALL
      8        SELECT 'test3' AS tab_name, 'user1' AS user_name
      9          FROM DUAL )
    10  --
    11     , my_all_tab_columns AS
    12       ( SELECT 'num1' AS col_name, 'test1' AS tab_name
    13          FROM DUAL
    14        UNION ALL
    15        SELECT 'sno1' AS col_name, 'test1' AS tab_name
    16          FROM DUAL
    17        UNION ALL
    18        SELECT 'dno1' AS col_name, 'test1' AS tab_name
    19          FROM DUAL
    20        UNION ALL
    21        SELECT 'num2' AS col_name, 'test2' AS tab_name
    22          FROM DUAL
    23        UNION ALL
    24        SELECT 'sno2' AS col_name, 'test2' AS tab_name
    25          FROM DUAL
    26        UNION ALL
    27        SELECT 'dno2' AS col_name, 'test2' AS tab_name
    28          FROM DUAL
    29        UNION ALL
    30        SELECT 'num3' AS col_name, 'test3' AS tab_name
    31          FROM DUAL
    32        UNION ALL
    33        SELECT 'sno3' AS col_name, 'test3' AS tab_name
    34          FROM DUAL
    35        UNION ALL
    36        SELECT 'dno3' AS col_name, 'test3' AS tab_name
    37          FROM DUAL )
    38  --
    39  SELECT col_name, tab_name
    40    FROM my_all_tab_columns
    41   WHERE tab_name IN ( SELECT tab_name
    42                          FROM my_user_tables
    43                         WHERE user_name = 'user1' );
    COL_ TAB_N
    num1 test1
    sno1 test1
    dno1 test1
    num2 test2
    sno2 test2
    dno2 test2
    num3 test3
    sno3 test3
    dno3 test3
    9 rows selected.
    SQL> WITH my_user_tables AS
      2       ( SELECT 'test1' AS tab_name, 'user1' AS user_name
      3          FROM DUAL
      4        UNION ALL
      5        SELECT 'test2' AS tab_name, 'user1' AS user_name
      6          FROM DUAL
      7        UNION ALL
      8        SELECT 'test3' AS tab_name, 'user1' AS user_name
      9          FROM DUAL )
    10  --
    11     , my_all_tab_columns AS
    12       ( SELECT 'num1' AS col_name, 'test1' AS tab_name
    13          FROM DUAL
    14        UNION ALL
    15        SELECT 'sno1' AS col_name, 'test1' AS tab_name
    16          FROM DUAL
    17        UNION ALL
    18        SELECT 'dno1' AS col_name, 'test1' AS tab_name
    19          FROM DUAL
    20        UNION ALL
    21        SELECT 'num2' AS col_name, 'test2' AS tab_name
    22          FROM DUAL
    23        UNION ALL
    24        SELECT 'sno2' AS col_name, 'test2' AS tab_name
    25          FROM DUAL
    26        UNION ALL
    27        SELECT 'dno2' AS col_name, 'test2' AS tab_name
    28          FROM DUAL
    29        UNION ALL
    30        SELECT 'num3' AS col_name, 'test3' AS tab_name
    31          FROM DUAL
    32        UNION ALL
    33        SELECT 'sno3' AS col_name, 'test3' AS tab_name
    34          FROM DUAL
    35        UNION ALL
    36        SELECT 'dno3' AS col_name, 'test3' AS tab_name
    37          FROM DUAL )
    38  --
    39  SELECT        'select '
    40             || SUBSTR ( MAX ( SYS_CONNECT_BY_PATH ( col_name, ',' )), 2 )
    41             || ' from '
    42             || tab_name
    43             || ';' query
    44        FROM ( SELECT tab_name, col_name
    45                    , ROW_NUMBER ( ) OVER ( PARTITION BY tab_name ORDER BY col_name )
    46                           rn
    47                FROM my_all_tab_columns
    48               WHERE tab_name IN ( SELECT tab_name
    49                                       FROM my_user_tables
    50                                      WHERE user_name = 'user1' ))
    51  START WITH rn = 1
    52  CONNECT BY PRIOR rn = rn - 1 AND PRIOR tab_name = tab_name
    53    GROUP BY tab_name
    54    ORDER BY tab_name;
    QUERY
    select dno1,num1,sno1 from test1;
    select dno2,num2,sno2 from test2;
    select dno3,num3,sno3 from test3;
    SQL>

  • ORACLE USER_TABLES

    i created table employee on system account, however tables are not appearing on the user_tables view is it possible to make it a user_table?
    SQL>
    SQL> SELECT TABLE_NAME,
    2 NUM_ROWS,
    3 BLOCKS ,
    4 EMPTY_BLOCKS,
    5 AVG_SPACE ,
    6 CHAIN_CNT ,
    7 AVG_ROW_LEN
    8 FROM user_tables
    9 WHERE table_name = 'employee';
    no rows selected
    SQL> select * from employee;
    EMP_ID EMP_NAME EMP_HIRED OU_ID
    1 NAME: 000001 01-MAY-99 1000
    2 NAME: 000002 01-MAY-88 1000
    3 NAME: 000003 01-SEP-93 1000
    4 NAME: 000004 21-AUG-00 1000
    5 NAME: 000005 01-SEP-00 1000
    6 NAME: 000007 21-MAY-99 1100
    7 NAME: 000007 13-SEP-89 1100
    8 NAME: 000008 01-MAR-99 1100
    10 JOHN SMITH 01-JUN-99 1000
    11 JOHN SMITH 01-JUN-99 1000
    12 JOHN SMITH 01-JUN-99 1000
    EMP_ID EMP_NAME EMP_HIRED OU_ID
    13 JOHN SMITH 01-JUN-99 1000
    13 rows selected.

    i created table employee on system accountYou're not supposed to create your own tables under SYSTEM. You need to drop it and recreate under your schema.

  • Why I cannot select on user_tables, user_views  etc when I am DBA?

    I came across something odd:
    I am logged on as DBA, when I do:
    Select * from user1.user_tables
    It gives me
    ERROR at line 1:
    ORA-00942: table or view does not exist
    I know I can use:
    Select * from dba_tables where owner = ‘USER1’
    but I am DBA and I can do select on every other thing in USER1 schema; why do I get errors on such statements.

    Run the following, send the results :
    DEFINE B='YOUHRIS'
    Prompt USER INFORMATION
    SELECT
    ' User '||username||'''S Account Information',
    ' Account Status => '||Account_status,
    ' Default Tablespace => '||default_tablespace,
    ' Temp Tablespace => '||temporary_tablespace
    from dba_users where username=upper('&&B')
    prompt OBJECTS OWNED BY USER
    select a.username LoginId,
    'User '||nvl(b.owner,'Does Not Own any objects..') ||' Owns ' ||nvl(b.cou,0)|| ' Nos Of ' ||nvl(b.object_type,'Objects')
    FROM
    dba_users a,
    (SELECT OWNER,OBJECT_TYPE,COUNT(OBJECT_NAME) cou FROM DBA_OBJECTS GROUP BY OBJECT_TYPE,OWNER ORDER BY OWNER,OBJECT_TYPE) b
    where a.username=b.owner (+) and a.username=upper('! &&B')
    Prompt SYSTEM PRIVIELGES GRANTED TO THE USER
    SELECT
    nvl(b.grantee,'No_System_Privileges_Granted'),nvl(b.privilege,'null')
    from
    dba_users a,dba_sys_privs b
    where a.username =b.grantee(+) and grantee=upper('&&B')
    Prompt ROLES GRANTED TO THE USER
    SELECT
    nvl(b.grantee,'No_Roles_Granted'),nvl(b.granted_role,'null')
    from
    dba_users a,dba_role_privs b
    where a.username =b.grantee(+) and grantee=upper('&&B')
    Oded
    [www.dbsnaps.com]
    [www.orbiumsoftware.com]

  • Discrepancies: USER_TABLES and USER_SEGMENTS

    In a schema HR (deployed when i installed Oracle 10g rel. 2), i run this statement:
    SQL> select segment_name from user_segments where segment_type='TABLE';
    and the result is:
    SEGMENT_NAME
    REGIONS
    LOCATIONS
    DEPARTMENTS
    JOBS
    EMPLOYEES
    JOB_HISTORY
    Selezionate 6 righe.
    If I run this statement:
    SQL> select table_name from user_tables;
    instead, the result is:
    TABLE_NAME
    REGIONS
    LOCATIONS
    DEPARTMENTS
    JOBS
    EMPLOYEES
    JOB_HISTORY
    COUNTRIES
    Selezionate 7 righe.
    Why i don't see COUNTRIES table in USER_SEGMENTS ?
    Regards.

    Hi,
    The segment can be anything like table, index or procedure..
    Check out the which kind of segment that is like "SEGMENT_TYPE" column from DBA_SEGMENTS

Maybe you are looking for

  • Problem with socket gateway

    I am trying to use the socket gateway to watch a port 1010 for all incoming data. When data comes in I want to log it. Well to get started I just used a simple example from the docs to see if I could get it to work. But when I try to start the gatewa

  • How do I get my hotmail to open in a new tab instead of a new window and I've tried the middle click/ctlr option.

    MSN is my home page and when I click on the hotmail link in the top left hand corner of the page it always opens in a new window even if I press middle-click/ ctrl keys. The hotmail link is the only link that I have had this problem with thus far. Ca

  • ORA-06502 when calling from a procedure

    HI, I have a procedure(p1) inside a package that queries a table and send out the result based on the input paramater value. OUT variable is of same type as the table column(using %type), column size is varchar2(4000). This procedure is called from a

  • Cannot login to CC&B

    Hi everybody, I am new to CC&B, the installed passed without any problem, when installing the framework V2.2.0 i specified : ==>Application admin user = usertest1 ==>application admin user password=usertest100 My problem is that i cannot connect to c

  • Mac iPhoto vs. PC File Structure

    As a new Mac user I'm new to OS X Yosemite.  Previously, in my old PC I could view all my photos as files that I could open, delete, etc.  Now, in iPhoto, these files are no longer visible, but apparently stored elsewhere that I can't seem to referen