Dropping the tables
Hi,
I wants to drop the selected tables from a user (eg:select table_name from user_tables where table_name like 'C%'). I created a temp table and inserted the selected table names.I need a procedure to drop all the tables.
suppose if table does not exist at the time of dropping it should continue dropping other tables.
can any one help me?
Thanks & regards,
Balaji tk.
Balaji,
I could see multiple issues with this code, i have corrected few in the code below.....since i dont have oracle in my system right now......rest you can trace and resolve, then tell us clearly the issue.But i m sure, the issue you are getting is due to some other error
CREATE OR REPLACE PROCEDURE Delete_Tables
IS
TYPE v_tables_temp IS TABLE OF varchar2 INDEX BY BINARY_INTEGER;
--TYPE v_tables_temp IS TABLE OF temp.table_name%TYPE INDEX BY BINARY_INTEGER;
v_tables v_tables_temp;
v_temp temp.table_name%TYPE;
cursor c is
SELECT table_name
FROM user_tables
WHERE table_name = v_tables(v_Index);
BEGIN
SELECT table_name bulk collect
--SELECT table_name
INTO v_tables
--FROM temp;;
FROM temp;
open c;
FOR v_Index IN 1..v_tables.COUNT
LOOP
fetch c into v_temp;
if (c%FOUND) then
EXECUTE IMMEDIATE 'Drop table v_tables(v_Index)';
--EXECUTE IMMEDIATE 'Delete from temp where table_name=v_tables(v_Index)';
end if;
--else
EXECUTE IMMEDIATE 'Delete from temp where table_name = v_tables(v_Index)';
commit;
END LOOP;
close c;
ENDCompare this with your code, and find the error u had in the code !!!
also grant direct DROP privelege to the table, and not through any role
Similar Messages
-
Ora-00604,ora-01422 error while dropping the table
Hi gurus,
I am using Oracle 10g R2 on windows 2000 platform,while dropping the table the following error occured.
ORA-00604 : error occurred at recursive sql level 1.
ORA-01422: exact fetch returns more than requested number of rows.
Need urgent help.
Thanks in advanceIs there an AFTER EVENT trigger defined on this database? Can you check that?
Secondly, was this database migrated from earlier version? I remember having seen this problem on 9i (it was 9.2.0.1 or 9.2.0.2; I can't recall exactly). -
Unable to descripe the table and unable to drop the table
Hi,
I have a temp table that we use like staging table to import the data in to the main table through some scheduled procedures.And that will dropped every day and will be created through the script.
Some how while I am trying to drop the table manually got hanged, There after I could not find that table in dba_objects, dba_tables or any where.
But Now I am unable to create that table manually(Keep on running the create command with out giving any error), Even I am not getting any error (keep on running )if I give drop/desc of table.
Can you please any one help on this ? Is it some where got stored the table in DB or do we any option to repair the table ?
SQL> select OWNER,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where OBJECT_NAME like 'TEMP%';
no rows selected
SQL> desc temp
Thank in advance.Hi,
if this table drops then it moved DBA_RECYCLEBIN table. and also original name of its changed automatically by oracle.
For example :
SQL> create table tst (col varchar2(10), row_chng_dt date);
Table created.
SQL> insert into tst values ('Version1', sysdate);
1 row created.
SQL> select * from tst ;
COL ROW_CHNG
Version1 16:10:03
If the RECYCLEBIN initialization parameter is set to ON (the default in 10g), then dropping this table will place it in the recyclebin:
SQL> drop table tst;
Table dropped.
SQL> select object_name, original_name, type, can_undrop as "UND", can_purge as "PUR", droptime
2 from recyclebin
SQL> /
OBJECT_NAME ORIGINAL_NAME TYPE UND PUR DROPTIME
BIN$HGnc55/7rRPgQPeM/qQoRw==$0 TST TABLE YES YES 2013-10-08:16:10:12
All that happened to the table when we dropped it was that it got renamed. The table data is still there and can be queried just like a normal table:
SQL> alter session set nls_date_format='HH24:MI:SS' ;
Session altered.
SQL> select * from "BIN$HGnc55/7rRPgQPeM/qQoRw==$0" ;
COL ROW_CHNG
Version1 16:10:03
Since the table data is still there, it's very easy to "undrop" the table. This operation is known as a "flashback drop". The command is FLASHBACK TABLE... TO BEFORE DROP, and it simply renames the BIN$... table to its original name:
SQL> flashback table tst to before drop;
Flashback complete.
SQL> select * from tst ;
COL ROW_CHNG
Version1 16:10:03
SQL> select * from recyclebin ;
no rows selected
It's important to know that after you've dropped a table, it has only been renamed; the table segments are still sitting there in your tablespace, unchanged, taking up space. This space still counts against your user tablespace quotas, as well as filling up the tablespace. It will not be reclaimed until you get the table out of the recyclebin. You can remove an object from the recyclebin by restoring it, or by purging it from the recyclebin.
SQL> select object_name, original_name, type, can_undrop as "UND", can_purge as "PUR", droptime
2 from recyclebin
SQL> /
OBJECT_NAME ORIGINAL_NAME TYPE UND PUR DROPTIME
BIN$HGnc55/7rRPgQPeM/qQoRw==$0 TST TABLE YES YES 2006-09-01:16:10:12
SQL> purge table "BIN$HGnc55/7rRPgQPeM/qQoRw==$0" ;
Table purged.
SQL> select * from recyclebin ;
no rows selected
Thank you
And check this link:
http://www.orafaq.com/node/968
http://docs.oracle.com/cd/B28359_01/server.111/b28310/tables011.htm
Thank you -
Hi Every one,
An error has occurred during report processing. (rsProcessingAborted)
Get Online Help
Query execution failed for data set 'NonFinTran'. (rsErrorExecutingCommand)
Get Online Help
Cannot drop the table '#NonFinTran', because it does not exist in the system catalog. Cannot drop the table '#MultipleNonFinTran',
because it does not exist in the system catalog. Transaction context in use by another session.
NOTE: NonFinTran &
MultipleNonFinTran are
the Temp table in my storedPoc.
Please any help me to solve this issue.
Thanks & Regards,
Anil Kumar
Anil KumarHi Harsh,
Below is my Stored Proc
SELECT @ServerName=datasource from master.dbo.sysservers WHERE catalog='Voyager'
SELECT @ServerName3=datasource from master.dbo.sysservers WHERE catalog='AuditLog'
SELECT @ServerName2=datasource from master.dbo.sysservers WHERE catalog='Portal'
IF @ServerName IS NOT NULL SET @ServerName='[' + @ServerName + '].' ELSE SET @ServerName=''
IF @ServerName3 IS NOT NULL SET @ServerName3='[' + @ServerName3 + '].' ELSE SET @ServerName3=''
IF @ServerName2 IS NOT NULL SET @ServerName2='[' + @ServerName2 + '].' ELSE SET @ServerName2=''
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')
DROP TABLE #NonFinTran
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')
DROP TABLE #MultipleNonFinTran
CREATE TABLE #NonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),
Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,
BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))
CREATE TABLE #MultipleNonFinTran (FirstName VARCHAR(40), TaxId VARCHAR(40), TrxID VARCHAR(40), Status VARCHAR(255), Field1 VARCHAR(255), Field2 VARCHAR(255),
Field3 VARCHAR(255), Field4 VARCHAR(255), Field5 VARCHAR(255), Field6 VARCHAR(255), DateTime DATETIME,
BranchID CHAR(3), BankID CHAR(1), FromAccountID VARCHAR(255), FromAccountType VARCHAR(255))
INSERT #NonFinTran
EXEC('SELECT FirstName, TaxID,
TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, DateTime, '''', '''', '''', ''''
FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser
WHERE CCUser.UserID = Audit.UserID
AND Audit.Succeeded = 1
AND Audit.TrxID IN (''ChangeBillPayDefaultAccountEdit'',''ChangeExpiryUserPassword'',''ChangePasswordEdit'',
''ChangeUserPassword'',''ManageAddressMaint'',''ManageContactMaint'',''ManageSecretQuestionAnswerEdit'',
''ManageTransLimitMaint'',''OtherBankAccountMaintAdd'',''OtherBankAccountMaintDelete'',''OtherBankAccountMaintEdit'',
''WithinAmBankAccountMaintAdd'',''WithinAmBankAccountMaintDelete'',''WithinAmBankAccountMaintEdit'',
''SetAccountMaskPreferenceAudit'',''ChangeLoginIdAudit'')
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')
INSERT #MultipleNonFinTran
EXEC('SELECT DISTINCT FirstName, TaxID,
TrxID, Status, TrxField1, TrxField2, TrxField3, TrxField4, TrxField5, TrxField6, Audit.DateTime as AuditDateTime,
(SELECT DISTINCT SUBSTRING(A.BranchCode,3,3) FROM ' + @ServerName + 'AuditLog.dbo.CCAuditLogEntryView X INNER JOIN ' + @ServerName + 'Voyager.dbo.CCuser U
ON X.UserId = U.UserId INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_CustomerProfile P ON P.EnrolId = U.TAXID
INNER JOIN ' + @ServerName + 'Voyager.dbo.AMHZ_AccountListing A ON A.CIFNO = P.CIFNO
WHERE X.UserId = Audit.UserId AND A.AccountNo = SUBSTRING(Audit.TrxField1,11,16) AND P.CIFNO = A.CIFNO
AND (SUBSTRING(A.BranchCode,3,3) <> NULL OR SUBSTRING(A.BranchCode,3,3) <> '''')
AND CHARINDEX(''AccountID='', Audit.TrxField1, 1) > 0),
SUBSTRING(TrxField1,14,1), CASE WHEN CHARINDEX(''AccountID='', TrxField1, 1) > 0 THEN
SUBSTRING(TrxField1,11,16) ELSE '''' END, CASE WHEN CHARINDEX(''AccountType='', TrxField2, 1) > 0 THEN SUBSTRING(TrxField2,13,3) ELSE '''' END
FROM ' + @ServerName3 + 'AuditLog.dbo.CCAuditLogEntryView AS Audit, ' + @ServerName + 'Voyager.dbo.CCUser AS CCUser
WHERE CCUser.UserID = Audit.UserID
AND Audit.Succeeded = 1
AND Audit.TrxID IN (''SetAccountAttributesAudit'',''SetAccountFriendlyNameAudit'',
''AccountProfileMaintULDelete'',''AccountProfileMaintLHAAdd'',''AccountProfileMaintLSCAdd'')
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @StartDate + '''), 103), Audit.DateTime) >= 0
AND DATEDIFF(DAY, CONVERT(DATETIME, CONVERT(VARCHAR(10), ''' + @EndDate + '''), 103), Audit.DateTime) <= 0 ')
SET @stmt = '
SELECT * FROM
SELECT BranchName,
CASE WHEN SUBSTRING(FromAccountID,1,6) IN (''519901'',''559409'') THEN ''DC''
ELSE
CASE FromAccountType WHEN ''01'' THEN ''SA '' WHEN ''02'' THEN ''CA '' WHEN ''03'' THEN ''FD ''
WHEN ''SA'' THEN ''SA '' WHEN ''CA'' THEN ''CA '' WHEN ''FD'' THEN ''FD '' ELSE FromAccountType + '' ''
END
END +
case when Len(FromAccountID) =16 Then
CASE FromAccountType WHEN ''VC'' THEN
SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4)
WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,4) END
when Len(FromAccountID) =15 Then
CASE FromAccountType WHEN ''VC'' THEN
SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3)
WHEN ''MC'' THEN SUBSTRING(FromAccountID,1,6)+''******''+SUBSTRING(FromAccountID,13,3) END
ELSE FromAccountID
ENd
AS FromAcctNo,
CASE TrxId
WHEN ''AccountProfileMaintLHAAdd'' THEN ''Link Account/Card''
WHEN ''AccountProfileMaintLSCAdd'' THEN ''Link Account/Card''
WHEN ''APMFamilyFirstAdd'' THEN ''Link Family First Account''
WHEN ''AccountProfileMaintULDelete'' THEN ''Unlink Account/Card''
WHEN ''BalInqFD'' THEN CASE WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE ''Fixed Deposit Balance Inquiry'' END
WHEN ''BalInqCASA'' THEN CASE WHEN Field3 IN (''APMLink=SUCCESS'') THEN ''APMLink Success'' ELSE
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Balance Inquiry''
ELSE ''Current Account Balance Inquiry''
END
END
WHEN ''StopCheck'' THEN ''Stop Cheque Request''
WHEN ''CheckReorder'' THEN ''Order Your Cheque''
WHEN ''CheckInquiry'' THEN ''Cheque Inquiry''
WHEN ''TransHistFD'' THEN ''Fixed Deposit Transaction History''
WHEN ''TransHistCASA'' THEN
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Transaction History'' ELSE ''Current Account Transaction History'' END
WHEN ''StmtInqCC'' THEN
CASE WHEN FromAccountType IN (''DR'',''03'') THEN ''Debit Card Statement Inquiry'' ELSE ''Credit Card Statement Inquiry'' END
WHEN ''StmtInqDA'' THEN
CASE WHEN FromAccountType IN (''SA'',''01'') THEN ''Savings Account Statement Inquiry'' ELSE ''Current Account Statement Inquiry'' END
WHEN ''StmtReq'' THEN ''Printed Statement Request''
WHEN ''StmtInqIAMSTAR'' THEN ''E-AMSTAR Statement Inquiry''
WHEN ''Repayment/Transfer Inquiry'' THEN ''Repayment/Transfer Inquiry''
WHEN ''Account Inquiry'' THEN ''Account Inquiry''
WHEN ''Payment Inquiry'' THEN ''Payment Inquiry''
END AS TransType,
FirstName AS CustomerName,
TaxId, CONVERT(VARCHAR, DateTime, 103) AS Date, CONVERT(VARCHAR, DateTime, 108) AS Time
FROM #NonFinTran, ' + @ServerName3 + 'Portal.dbo.TB_Branch AS TB_Branch
WHERE
BranchId = TB_Branch.BranchCode
AND (TB_Branch.InstCode IN (''00001'', ''00003'',''001'',''002''))
AND (FromAccountType IN (''SA'', ''CA'', ''FD'', ''01'', ''02'', ''03'')))'
EXEC (@stmt)
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#NonFinTran%')
DROP TABLE #NonFinTran
IF Exists(Select * From tempdb.dbo.SysObjects Where Name Like '#MultipleNonFinTran%')
DROP TABLE #MultipleNonFinTran
Anil Kumar -
How to find who dropped the table
Hi Gurus,
Is there a way beside auditing to know who dropped the table,i know we could use logminer for that but the thing is that i don't have supplemental logging turned on while the table got dropped.
I think we need to have supplemental logging enabled to find who did what even for the DDL correct?
Is there any way i can find who dropped the table?
Thanksuser9097501 wrote:
Hi Gurus,
Is there a way beside auditing to know who dropped the table,i know we could use logminer for that but the thing is that i don't have supplemental logging turned on while the table got dropped.
I think we need to have supplemental logging enabled to find who did what even for the DDL correct?
Is there any way i can find who dropped the table?
ThanksI can think about 2 different ways to do it ;
1- by using Audit http://www.oracle-base.com/articles/10g/Auditing_10gR2.php ; if it's enabled
2- or there another method , does not give a real precision, but could be helpful if the audit is not enabled ; can be to check listener log. Listener does show database connection requests. So if you know the time the table was dropped (SELECT DROPTIME
FROM DBA_RECYCLEBIN
WHERE Owner = 'XXX'
AND ORIGINAL_NAME= 'YYYYYY'), you can see from the listener log what connected to the database at that time. (asuming that the connection request was from a remote client, not the DB server)
E.g if I found that the table were dropped at 14:45:18 then I can tell from my listener log that it is probably due to a user connected by the portal application on host portal.es6.orawiss.net:
23-AUG-2010 14:45:18 * (CONNECT_DATA=(SID=DB02)(CID=(PROGRAM=httpd)(HOST=portal.es6.orawiss.net)(USER=apache))) * (ADDRESS=(PROTOCOL=tcp)(HOST=192.168.44.30)(PORT=60618)) * establish * DB02 * 0
Listener logs are an important source of audit information.
Hope it helps :) -
How to drop the tables (articles) in subscription database MERGE replication.
We have configured the merge replication from publication server to subscription server,
Here I mistakenly selecting few tables (articles) in publication,
Now I need to remove those mistakenly selected tables in subscription server database .
Note: I am trying to below way but unable to remove those tables in subscription server.
1<sup>st</sup> I unselected those tables (articles) in publication, but not working.
Could please tell me the how to remove those tables in subscription database.Ok that is normal, dont worry, if you mistakenly chosen few tables, just add the new tables
that you forgot it, just make click on the publication, you only have to Re-run the snapshot agent, i mean you must generate another snapshot and then synchronice with your suscriber, and then you will not need DROP the tables on the suscriber, if you have
troubles yet, please post imagens to help you more !
Thanks and regards. -
How to find the user who dropped the tables
Hi All,
Some one has dropped 5 tables in the production database that has caused a SEV1 but thankfully we are having those tables in recyclebin and we are restored those with out data loss.
But I want to know who has dropped those tables and want to know who has connected to database at that time. Can you please guide me in this how to find out....
Database version: 11.2.0.2 version
Thanks
Kk
Edited by: 908098 on Jan 18, 2012 4:23 AMOr you can use this kind of audit (i had used this some time ago)
-is pretty detailed but is good for auditing purpuse.
hope this helps
CREATE TABLE AUDITORIA_ESQUEMA (
operation VARCHAR2(30),
os_user VARCHAR2(30),
obj_owner VARCHAR2(30),
object_name VARCHAR2(30),
object_type VARCHAR2(30),
sql_text VARCHAR2(64),
attempt_by VARCHAR2(30),
attempt_dt DATE,
Ip_adress VARCHAR2(15));
CREATE OR REPLACE TRIGGER AUDITORIA_ESQUEMA
BEFORE CREATE OR ALTER OR DROP OR RENAME or alter
ON DATABASE
DECLARE
oper varchar2(200);
sql_text ora_name_list_t;
i PLS_INTEGER;
BEGIN
SELECT ora_sysevent
INTO oper
FROM DUAL;
i := sql_txt(sql_text);
IF oper IN ('CREATE', 'DROP','RENAME','ALTER') THEN
INSERT INTO AUDITORIA_ESQUEMA
SELECT ora_sysevent,(select sys_context('USERENV','OS_USER') from dual)
, ora_dict_obj_owner,
ora_dict_obj_name,ora_dict_obj_type, sql_text(1), USER, SYSDATE,
(select SYS_CONTEXT('USERENV', 'IP_ADDRESS') from dual)
FROM DUAL;
ELSIF oper = 'ALTER' THEN
INSERT INTO AUDITORIA_ESQUEMA
SELECT ora_sysevent,(select sys_context('USERENV','OS_USER') from dual)
, ora_dict_obj_owner,
ora_dict_obj_name,ora_dict_obj_type, sql_text(1), USER, SYSDATE,
(select SYS_CONTEXT('USERENV', 'IP_ADDRESS') from dual)
FROM sys.gv_$sqltext
WHERE UPPER(sql_text) LIKE 'ALTER%'
AND UPPER(sql_text) LIKE '%NEW_TABLE%';
END IF;
END AUDITORIA_ESQUEMA; -
Hello,
I am going to drop some tables in production environment for the first time do i need to check the mode of the tablespace?
Thanks,
New_to_oracleThis is a forum, not a chat. Please read documentation before question.
Handle: Sunny4989
Status Level: Newbie
Registered: Jun 20, 2012
Total Posts: 29
Total Questions: 11 (9 unresolved)
Name Sunil
And mark answered the post to clean the forum when your question will be solved. -
how to drop the all tables in database.
i have 10 tables in my database. so all tables drop at a time(single command)
and please let me know how to drop these kind of tables
SYSADM_UCAT
TIMESTAMP_TEST
ONGC
BIN$65N+ZC4tRYSMT4baQKQIeg==$0
BIN$HgYs2odgQEWr11WKR15T4A==$0
BIN$C+PVsIx/TdGggvVbF//ipQ==$0
BIN$jfKSLW3eRBqDWkVSpZlXyw==$0
any reply
thanksthis are oracle table why do you want to drop them
http://www.oracle.com/technology/pub/articles/10gdba/week5_10gdba.html
http://orafaq.com/node/968
BIN$65N+ZC4tRYSMT4baQKQIeg==$0
BIN$HgYs2odgQEWr11WKR15T4A==$0
BIN$C+PVsIx/TdGggvVbF//ipQ==$0
BIN$jfKSLW3eRBqDWkVSpZlXyw==$0 still somthing like this?
begin
for i in (select table_name from user_tables)loop
execute immediate ' drop table '||i.table_name;
end loop;
end; -
Cannot drop the table - cannot enable compression - cannot find the object
Hi,
I'm trying to install Database Instance as a 2nd part of distributed SAP system. There was already MS SQL 2008 STD installed, I installed another MS SQL 2008 STD instance manually (as described in PI installation guide) from original MS SQL 2008 STD DVD, not one provided by SAP. The database is created by SAPinst, and we have a crash at the beginning of ABAP import phase:
Here is a log: -> http://wklej.org/id/392174/
I thought I can run development SAP system on Standard Edition. Am I right and this is just permission problem? How to troubleshoot that?
Thanks for any suggestions.
Regards,
KHi Sven,
Thanks, &norowcompression& did the trick!
Does anyone know is this type of installation (not SAP's MSSQL media, STD Edition for dev/qas system, MS SQL instance for SAP with another MS SQL instances on the same server) is supported?
Thanks again,
K
//edit:
no it's not supported:
Note 62988 - Support Packages for Microsoft SQL Server
"Supported editions
All supported SQL server releases are tested by SAP in the Enterprise Edition only. Therefore, only the Enterprise Edition is supported. The SAP support may not be able to solve problems that occur with other editions."
Edited by: Konrad Kostecki on Sep 23, 2010 10:22 AM -
Creating a Mat View having the same name with that of the table name
Hi everyone,
After dropping the mat view name "QQ.TRDLN_DIM_MV", I'm trying to re-create it by having the same name as that of the table but I got an error stating that "name is already used by an existing object". How can create a mat view to look like the object owned by schema "GQ", having a name that is the same as that of the table name, without dropping the table?
OWNER_O OBJECT_TYPE CREATED LAST_DDL_ TIMESTAMP STATUS OBJECT_NAME
===
GQ MATERIALIZED VIEW 05-NOV-08 13-DEC-08 2008-11-05:06:31:46 VALID TRDLN_DIM_MV
GQ TABLE 05-NOV-08 15-DEC-08 2008-11-05:06:31:00 VALID TRDLN_DIM_MV
QQ TABLE 17-AUG-07 16-MAR-09 2007-08-17:17:05:21 VALID TRDLN_DIM_MV
SQL>CREATE MATERIALIZED VIEW QQ.TRDLN_DIM_MV
2 TABLESPACE FPLC01S
3 NOCACHE
4 NOLOGGING
5 COMPRESS
6 PARALLEL ( DEGREE 2 INSTANCES 1 )
7 BUILD IMMEDIATE
8 REFRESH FORCE ON DEMAND
9 WITH PRIMARY KEY
10 AS
11 select /*+ NO_REWRITE */ trdln_id,
12 trdln_skid,
13 trdln_end_date,
14 first_value(trdln_end_date) over (partition by trdln_id order by trdln_end_date DESC) as MaxDate
15 from QQ.trdln_dim;
from QQ.trdln_dim
ERROR at line 15:
ORA-00955: name is already used by an existing object
I appreciate your help. Many thanks in advance!
Regards,
RadicYou'd have to rename the table (using ALTER TABLE tablename RENAME TO othername; ) before you create the MV.
You can't have both existing with the same name in the same schema.
What you see in the GQ schema is that the "table" is the underlying table for the Materialized View.
When you do a CREATE MATERIALIZED VIEW MY_MV AS ...
Oracle creates two objects with the same name, one being the Materialized View MY_MV and the other being the table MY_MV which is the physical storage. {Remember that a Materialized View is a means of getting a physical representation of a View}.
In the QQ schema what you have is either
a. a real Table
or
b. an improperly dropped MV, resulting in the underlying Table still present. -
Creating file containing a RecCount of the table
I have a SP which dynamically Creates a <Table1> populate it with data. This SP is called from the SSIS package and at the end of package I'll drop the table <Table1> created in the SP.
But Before dropping it, I have to generate 2 files using the table created in the SP
1. One which gives the count of that table <table1> in file ( just count and nothing in that file)
2. A .txt file containing entire dump of that table <table1>
I have developed a CM for txt file, which dynamically constructs the file name and path( this one I have tested working) figure 2
figure1 :- ESQL1 Get the file and folder path details and execute the SP -- this working
ESQL2 Get the Name & count from the <Table1> in a package variable --This is also working
ScriptTask to construct the full path where the files to be placed --This is also working
Now what is failing is, I am not able to pass the name of the table from OLEDB using the variable to the flat file destination transformation.Hi Neil,
If I understand correctly, you have already generate a text file that store the count of the table. Then you want to generate another file that contains all the table data in another Data Flow Task before dropping the table.
If in this scenario, I suggest we can insert another Data Flow Task connect to the current Data Flow Task. Then directly load the table data from OLE DB Source to Flat File Destination. After the Data Flow Task, we can insert Execute SQL Task to drop the
table.
If you still couldn’t execute the package successfully, please post the error message from Output windows. If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
How to drop a table in another schema.
Hi there, was looking to drop a table that is currently created under GL schema when consolidation process is done. These tables are kind of temporary and stay there if consolidation process doesn't complete successfully.
So, I'm try to execute a script that would drop the table but the particularity is that this drop isn'T executed by apps but with bolinf (custom user).
So, while trying to delete it with bolinf, I always get an error message that the table doesn't exists or so.
Here's the code
r_gl_int_ctrl.INTERFACE_TABLE_NAME is retreived from gl_interface_control table and from INTERFACE_TABLE_NAME column.
EXECUTE IMMEDIATE 'DROP TABLE GL.' || r_gl_int_ctrl.INTERFACE_TABLE_NAME;
and this generates the following error : ORA-00942: table or view does not exist
R12.0.6
RDBMS 10.2.0.3.0
Custom package under bolinf schema is trying to drop GL.GL_CONS_INTERFACE_38190 and it's not working. Nevertheless, if I install this package under apps, table get dropped.
Is there a way that I can drop a GL table like GL.GL_CONS_INTERFACE_38190 from BOLINF schema ? If so, what privileges/grant should user BOLINF have in order to drop this table from a GL Schema ?
Thank you.Hi;
You need to give drop grant to your user.Easy way is to give
GRANT DROP ANY TABLE TO USER; << but its mean it will give drop grant for all table.
Also see:
OERR: ORA 942 "table or view does not exist" [ID 18536.1]
Regard
Helios -
Getting the tables actively used in the schema
Hello,
We are in need of releasing space from the schema we use.
Can anyone please suggest how to find the tables that has not been used for a given amount of time. So that we can drop the tables which are not effectively used by the application..
Thanks and Regards.
Sathiyauser13299583 wrote:
Thanks for the replies ..
Actually the application was designed/created long back .. Lots of changes has been incorporated and lots of features has been removed from the application..
But in the backend the associated tables were not removed and we feel that it occupies huge space in the server ..
I am afraid i can enable auditing as it is a production instance and lots of formalities are involved if we have restart the server ..
Is there any other way to find out the tables which has not been touched, for a period of time ..
The project has been switched over to many people so there are no proper documentation available .. So we are forced to find some alternatives to identify the unused tables ..
Thanks,
Sathiya.What about using triggers and logging? -
We are currently converting our student information system from Sybase to Oracle. My task is to convert our existing sql scripts. A number of them use temp tables and I have successfully got them to run except that I cannot drop the tables at the end of the script because they are still in use *[Error Code: 14452, SQL State: 72000] ORA-14452: attempt to create, alter or drop an index on temporary table already in use*. For example:
/* Oracle Version */
-- Select Cactus ID ------------------------------------------------------------
CREATE GLOBAL TEMPORARY TABLE tch1
(name Varchar(45), tid Int, CactusID Varchar(12))
ON COMMIT PRESERVE ROWS;
INSERT INTO tch1
SELECT
t.lastfirst,
t.id teacherid,
c.value
FROM
teachers t
INNER JOIN customvarchars c ON t.id = c.KeyNo
AND fieldno = 148;
-- Select Core Codes ---------------------------------------------------------------
CREATE GLOBAL TEMPORARY TABLE crs1
(name Varchar(45), cid Int, CactusCd Varchar(12))
ON COMMIT PRESERVE ROWS;
INSERT INTO crs1
SELECT
cs.course_name,
cs.id courseid,
c.value
FROM
Courses cs
INNER JOIN customvarchars c ON cs.id = c.KeyNo
AND fieldno = 146;
-- Put it all together ---------------------------------------------------------
SELECT
t.lastfirst AS Teacher,
ct.CactusID,
s.schoolid AS Sch#,
s.TermID,
c.course_number AS Crs#,
s.section_number AS Sec#,
c.course_name AS Course,
cr.CactusCd,
COUNT(*) AS Enroll
FROM
cc
INNER JOIN sections s ON cc.sectionid = s.id
INNER JOIN courses c ON s.course_number = c.course_number
LEFT JOIN crs1 cr ON c.id = cr.cid
INNER JOIN teachers t ON s.teacher = t.id
LEFT JOIN tch1 ct ON t.id = ct.tid
WHERE s.schoolid NOT IN (701,711)
GROUP BY
s.schoolid,
t.lastfirst,
ct.CactusID,
c.course_number,
s.section_number,
c.course_name,
cr.CactusCd,
s.TermID
ORDER BY
s.schoolid,
t.lastfirst,
ct.CactusID,
c.course_number,
s.section_number,
c.course_name,
cr.CactusCd,
s.TermID;
-- Drop Tables -----------------------
DROP TABLE tch1;
DROP TABLE crs1;
I have an Oracle PL/SQL reference guide at hand, but I don't see any mention of dropping the tables when completed. I'm also curious if I'm using the terminator (;) correctly. MS SQL Server and Sybase did not require one.
Thanks.Christopher Soza wrote:
you need to issue a
COMMIT;
prior to issueing the drop table commands
COMMIT will not help since GTT is ON COMMIT PRESERVE ROWS:
Session 1:
SQL> CREATE GLOBAL TEMPORARY TABLE tch1
2 (name Varchar(45), tid Int, CactusID Varchar(12))
3 ON COMMIT PRESERVE ROWS;
Table created.
SQL> insert into tch1 values('A',1,'B');
1 row created.
SQL> commit;
Commit complete.
SQL> Session 2:
SQL> drop table tch1;
drop table tch1
ERROR at line 1:
ORA-14452: attempt to create, alter or drop an index on temporary table already
in use
SQL> SY.
Maybe you are looking for
-
IMovie 8.0.6 doesn't recognize my iSight camera.
I have a Mid 2010 MacBook Pro running OS X 10.9.5; iMovie 8.0.6 doesn't recognize my iSight camera. The iSight camera works on Skype, Photo Booth and FaceTime. I hadn't used iMovie in almost a year, however, the last time it recognized the iSight c
-
Broken screen, not cracked glass on Xperia Z2
Sounds like a GPU issue (Graphics chip) so I'm sorry to hear this but you would need to either return your device to the place of purchase or contact Xperia care and have your device inspected http://www.sonymobile.com/global-en/support/contact-us/
-
Does anyone know how to trunk two Gigaswift ethernet interfaces? The Solaris Trunking software is only supported on Solaris 7-9. There doesn't seem to be built in functionality in Solaris 10 to enable trunking. Thanks, Dwain
-
Hello Experts! I have a crosstab, which contains Years on the left and some statstic values on the right for each Schools. Since not all schools have data for each years. My crosstab will skip some rows when no data have found for some years of the
-
How to configure adapter monitoring in XI?
Please help. Points guaranteed.Thanks!