SQL & PL/SQL :: Removing Subpartitions And Preserving Data?
May 3, 2012
I've a table in data warehouse production with data which is partitioned by RANGE, sub-partitioned by HASH.Later we realized that subpartitioned are not needed as volume is less.
I tried below approah in DEV DB:
1. create table ABC_BAK as select * from ABC;
2. dbms_metadata.get_ddl('TABLE','ABC')
3. Removed the subpartitions details from the output of step 2 and prepared the script of create table without subpartitions
4. Drop table ABC
5. Create table ABC from script step 3.
6. Insert into ABC select * from ABC_BAK
7. Drop table ABC_BAK
View 1 Replies
ADVERTISEMENT
Nov 21, 2012
way to delete my subpartitions by keeping my datas, and keep it into my partitions. In fact, i want to remove my subpartitions, and keep my table partitionning. I already remove my subpartition template, but i don't want to do an insert as select on a new table wich will be partitionned (without subpartitions). ALTER TABLE myTable SET SUBPARTITION TEMPLATE ();
View 6 Replies
View Related
May 9, 2010
While there's numerous QAs about inserting an image into the DB using the Data Block, how does one remove an image? Obviously there's the "UPDATE ... SET X = EMPTY_BLOB();", however, that kills the Data Block/Form's flow, and it doesn't update.
I've tried a few things:
* :CONTROL.IMG1 := NULL; (bad bind variable)
* :CONTROL.IMG1 := EMPTY_BLOB(); (some other error, probably as above)
View 2 Replies
View Related
Oct 23, 2012
We are on Oracle 10.2.0.4 on Solaris 10. There is a table in my production db that has 872944 number of rows. Most of its data is now unnecessary, we need to retain, based on a date column in the table just last one month's data and delete rest of the data. So after that the table will have just 3000 rows.
However as the table was huge earlier(872k rows prior to delete) , does the delete of data release its oracle blocks and does the size of the table reduce? If not, will it rebuild the table online (online redefinition) so that the query that does a full scan on this table goes faster?
I checked using an example table that just delete of data does not remove the oracle blocks - they remain in the user_tables for that table and cost of full table scan remains same. We have a query that does the full table scan so I am thinking that after this delete I should do an online table re-definition , is that the right decision?
View 4 Replies
View Related
Oct 24, 2011
I created table Rang pertitionned, and List subpartitionned. My table is Interval partitionning. My subpartition is template based as is :
PARTITION BY RANGE ( DINFOIDENTITE )
INTERVAL ( (NUMTOYMINTERVAL(1,'MONTH')) )
SUBPARTITION BY LIST ( AVANT_DERNIER_MATCLE )
[Code]....
i would have the same repartition with 10 differents tablespaces, one for each subpartition.
I search on Oracle documentation this morning, but the only thing i've found is that this option is possible with the STORE IN clause, but only for HASH partitionning.
Is there a way to specify STORAGE clause with a template for my indexes ?
View 4 Replies
View Related
Sep 19, 2013
db and dev 10g rel2 ,suppose that i have a table with a lot of duplicate rows ,what i need is to delete the duplicates and retain one row of these duplicates . likecolumn -- with those values...how to delete two (hi's) and retain the third , ?it is all applied to all the duplicate values in the column.
View 5 Replies
View Related
Jul 3, 2008
Trying to delete duplicate rows from a table. The problem is, they aren't exactly duplicate rows. Let me explain.
I am migrating data from a Oracle 8.1.7 db to a 10.2.1 db. In the older db, this certain table does not have a PK/Unique Index, but in the new db there is a unique index. The fields that the index is unique on are:
SUBSCR_NO, SUBSCR_NO_RESETS, EXTERNAL_ID, EXTERNAL_ID_TYPE, ACTIVE_DATE.
In the old db, when I run this query I get 1229 rows. With a count of 2 each.
select SUBSCR_NO, SUBSCR_NO_RESETS, EXTERNAL_ID, EXTERNAL_ID_TYPE, ACTIVE_DATE, count(*)
from customer_id_equip_map
group by SUBSCR_NO, SUBSCR_NO_RESETS, EXTERNAL_ID, EXTERNAL_ID_TYPE, ACTIVE_DATE
having count(*)>1;
They are duplicates on those fields, but they are not totally duplicate rows because there is a field called is_current that has 0 in one row and has 1 in the other. What I need to do, is delete the 1229 rows with is_current=0.
View 4 Replies
View Related
Aug 5, 2012
To remove fragmentation which is the best method.
First one :
-----------------
1)Created a backup table from the Fragmented table (This table is a partitioned one).
2)Analyzed this table.
3)DROP the Fragmented table
4)Inserted the backuped up data from backup table to the Re-created table.
5)Analyze this table.
Second method
-------------------
1) Create a backup table newly, with PCTFREE =0
2) Inserted the data from Fragmented table ( This is a partitioned table) to backup table
3) Analyzed this table.
4) Truncate Fragmented table
4) Did Exchange partition of Fragmented table with Backup table.
The second method is not found to be removing the Fragmentation. Before the fragmentation was 28% after Second method the fragmentation is still the same. While the first method the fragmentation reduced to 16%.
Query used to find Fragmentation.
select table_name,
round((blocks*8),2) "table size kb",
round((num_rows*avg_row_len/1024),2) "actual data in table kb",
round((blocks*8),2)- round((num_rows*avg_row_len/1024),2) "wasted space kb",
[code]...
View 9 Replies
View Related
Sep 10, 2010
TYPE CashRecord IS RECORD(client_id VARCHAR2(100),
account_letter VARCHAR2(100),
cash_amount VARCHAR2(100),
cash_amount_ccy VARCHAR2(100) );
TYPE CashRecordTable IS TABLE OF CashRecord INDEX BY VARCHAR2(100); -- Indexed by client_id~account_letter~ccy
So if I did something like this;
l_cash_records CashRecordTable;
-- say for example that l_cash_rec/l_cash_rec2 has been defined..
l_cash_records('some index') := l_cash_rec;
l_cash_records('some index 2') := l_cash_rec2;
l_cash_records.COUNT would give me 2
How can I somehow remove 'some index 2' so that l_cash_records.COUNT is 1 ?
View 3 Replies
View Related
Jan 26, 2012
This is a simple question, but I cannot seem to find a solution. Here's the basic query:
select distinct accountno, parcelno, streetno||' '|| predirection ||' '|| streetname||' '|| streettype||' '|| postdirection||' '|| unitname||', '|| propertycity
from tblacctpropertyaddress ....
What I want to do is add is this logic: If Predirection is null, then no space between streetno & streetname. Same for postdirection and unitname. (for example, if both postdirection and unitname are null, there are no spaces between streettype and the comma before propertycity)
Also, when unitname is not null, I want to add the string "Unit " prior to the returned value in unitname.
View 5 Replies
View Related
Dec 10, 2012
One of my clients need to remove three(of four) CPU to comply the licensing agreement with Oracle.
To avoid problems and also to list the possible problems that removing the CPU can bring, I wish to make a survey of the possible impacts, especially in performance, that removal can cause.
How can I get this information?
View 8 Replies
View Related
Dec 27, 2006
I am working with Oracle 10G, and have been working on setting up little pl/sql checks to make sure that the data that is imported is in the correct format.
The wall I have hit is removing illegal characters from the data I import. I have started to set something up where the string for a certain column must be be made of only there characters:
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-" (note that there is a - besides just letters) and I may want to add some other characters later. So basically the script will drop or replace any character not found in my definitions with "", thus removing the illegal character and joining the previous and next characters.
I thought for sure there would be a script posted somewhere online that did this but I can't find it and my syntax skills are lacking.
View 8 Replies
View Related
Jul 18, 2013
I have requirement to suppress the duplicate nodes on same level in hierarchy query.
Below given is the script for it.
CREATE TABLE NODE_LVL (PARENT_NODE VARCHAR2(100), CHILD_NODE VARCHAR2(100));
INSERT INTO NODE_LVL VALUES('TBL_APL','TBL_AFL');
INSERT INTO NODE_LVL VALUES('TBL_APP','TBL_ACS');
INSERT INTO NODE_LVL VALUES('TBL_ADD','TBL_ADW');
INSERT INTO NODE_LVL VALUES('TBL_ADP','TBL_ADV');
INSERT INTO NODE_LVL VALUES('TBL_AOP','TBL_AOV');
[code]......
Table 'TBL_APP' is having 2 parent nodes i.e 'TBL_AOV' and 'TBL_ADV'
SELECT * FROM node_lvl WHERE child_node = 'TBL_APP';
At level 5 there is duplicate nodes i.e 'TBL_APP' and 'TBL_ACS' as parent_node and child_node respectively.
SELECT PARENT_NODE, CHILD_NODE, LEVEL FROM NODE_LVL START WITH PARENT_NODE = 'TBL_ACF' CONNECT BY PRIOR CHILD_NODE = PARENT_NODE;
I want to suppress such duplicates. So I added DISTINCT
SELECT DISTINCT PARENT_NODE, CHILD_NODE, LEVEL FROM NODE_LVL START WITH PARENT_NODE = 'TBL_ACF' CONNECT BY PRIOR CHILD_NODE = PARENT_NODE;
BUT requirement is to maintain the same order (of hierarchy) as it was before adding DISTINCT.
View 11 Replies
View Related
Dec 13, 2008
I am persisting xml with below mention tag which contains preformatted text data.
<SECTION>
<HDG><![CDATABusiness Summary]></HDG>
<BODY>
<![CDATA[(C) 2008 D&B
COPYRIGHT 2008 DUN & BRADSTREET INC. - PROVIDED UNDER CONTRACT
FOR THE EXCLUSIVE USE OF SUBSCRIBER 263763803.
ATTN: null
[code]....
Now, when i retrieve this xml from oracle CLOB column, i am getting data in body tag as below:
(C) 2008 D&B COPYRIGHT 2008 DUN & BRADSTREET INC. - PROVIDED UNDER CONTRACT FOR THE EXCLUSIVE USE OF SUBSCRIBER 263763803. ATTN: null US TEST COMPANY 984 DUNS: 36-252-8379 RATING DS US FICTITIOUS COMPANY 984 BUSINESS SERVICES EMPLOYS UNDETERMINED 899 EATON AVE SIC NO. BETHLEHEM PA 18025 7389 TEL: 610 882-0005 RICHARD DOE, MANAGER RECORD TYPE: DUNS SUPPORT THE "DS" INDICATOR ASSIGNED TO THIS BUSINESS MEANS THAT THE LIMITED INFORMATION CURRENTLY IN THE D&B FILE DOES NOT ALLOW US TO CLASSIFY IT WITHIN OUR RATING SYSTEM. WE ARE PROVIDING THIS INFORMATION TO YOU IN THE INTEREST OF SPEED WITHOUT HAVING COMPLETED AN INVESTIGATION. THEREFORE, THIS REPORT MAY NOT REFLECT THE CURRENT STATUS OF THIS BUSINESS. D&B CAN INVESTIGATE THIS BUSINESS AND UPDATE THIS INFORMATION BASED ON THE RESULTS OF THAT INVESTIGATION.
All text formatting goes for a toss (newline, trailing tab characters are getting trimmed).provide any inputs on how to avoid this. Text formatting needs to be preserved.
View 1 Replies
View Related
May 31, 2012
I am trying to remove duplicates from a table with over 10million records. Below query is working fine but it doesnt contain any COMMIT interval. I have to commit after every 20k or 30k records deletion for which IF loop is necessary.
Query:
delete from
customer
where rowid in
(select rowid from
(select
rowid,
row_number()
over
(partition by custnbr order by custnbr) dup
from customer)
where dup > 1);
View 9 Replies
View Related
Dec 16, 2010
The other day, we had a query run amok in our 2-node production cluster. The 3 temp files for the temp tablespace were all still set to autoextend unlimited, something I forgot to change after a recent upgrade. I created 3 new temp files and tried to delete the huge temp files. I did this from sqlplus with this commad:
ALTER TABLESPACE PSTEMP DROP TEMPFILE '+DATA/isis/tempfile/pstemp.291.641298061';
The huge files are still in ASM storage. dba_temp_files reports that the status of them is AVAILABLE but they have no RELATIVE_FNO. Grid Control reports their status as OFFLINE and their size as 0. They are actually close to 20 GB each.
I tested the above alter statement in two test instances, also RACed with ASM storage and the temp files were successfully deleted, but they were much smaller in size. At this point, how do I delete the three 20GB files from ASM in our production instance? Why didn't they delete the first time?
View 1 Replies
View Related
May 13, 2010
I am trying to select a row on the screen and delete a individual row from the screen after hitting the delete button. Whenever i select the row it gets highlighted and also the alert box comes up asking if the record needs to be deleted. When I say yes I notice that the row does not get deleted. The code behind the delete button is as follows
(P.S the block is based of a table and commit_form works and changes are saved to db but not delete_record)
begin
--
Set_Item_Property('my_block.emp_no_copy',current_record_attribute,'va_delete_record');
Set_Item_Property('my_block.emp_LName_copy',current_record_attribute,'va_delete_record');
Set_Item_Property('my_block.emp_FName_copy',current_record_attribute,'va_delete_record');
Set_Item_Property('my_block.last_worked_date_copy',current_record_attribute,'va_delete_record');
--
synchronize;
Set_Alert_Property(alert_id, ALERT_MESSAGE_TEXT, 'Do you want to delete the Highlighted record? {NOT YET}');
[Code]....
View 4 Replies
View Related
Jul 12, 2010
Due to improper documentations of a certain project, I need to drop a DEFAULT tablespace of a newly created instance including it's associated datafiles by using this command:
"DROP TABLESPACE <tablespace name> INCLUDING CONTENTS AND DATAFILES;"
The default tablespace name is QWER (qwer01.dbf) and I added 2 datafiles in it, re: OPD_SML01.dbf & EXYT_SML01.dbf.
Do I have to do it online or offline?
View 1 Replies
View Related
Aug 18, 2010
I am using 10g reports.
I created a report (its basically a statement) without a header. When I run the report, blank lines appear at the top of the report before the details start printing. How do I get the report to print from the top of the page without leaving any blank lines.
View 3 Replies
View Related
Apr 10, 2013
I have a table like:
0035987850 P
0035987851 P
0035987852 P
I would like to update removing 00 in the first column. So after update to have:
35987850 P
35987851 P
35987852 P
View 5 Replies
View Related
Mar 17, 2010
My requirement if id, join_date, join_time, result of table1 is matched with table2 at least one time then if repeating rows associated with the id should not come.Here is the test case.
create table table1
( id number , join_date varchar2(8), join_time varchar2(6), status varchar2(10));
create table table2
( id number , join_date varchar2(8), join_time varchar2(6), status varchar2(10));
insert into table1 values (01, '20010101', '0500', 'PASS');
insert into table1 values (01, '20010102', '0501', 'FAIL');
insert into table1 values (02, '20010103', '0502', 'PASS');
insert into table1 values (03, '20010104', '0503', 'FAIL');
insert into table1 values (04, '20010105', '0504', 'PASS');
insert into table1 values (05, '20010106', '0505', 'FAIL');
[code]...
I have tried the below mentioned query, whether any better query is there than this because in real-time data have 2 millions of record in table 1 and 60 thousand in table2.
select distinct a.id, a.join_date, a.join_time, a.status
from table1 a, table2 b
where a.id = b.id
and (a.id, a.join_date, a.join_time, a.status) not in (select b.id, b.join_date, b.join_time, b.status
from table2 b)
and a.id = (
select distinct a.id
[code]....
View 20 Replies
View Related
Sep 10, 2012
RMAN is not removing obsolete backups and now the backup directory is nearly full.Retention policy is 1, however, there are backups more than 6 weeks old still in the backup directory.crosscheck and delete obsolete commands run every night, and I have also run these manually, yet the backup files still remain.It is like RMAN is not aware of their existance.How can I confirm that RMAN does not need them and therefore delete them manually using OS commands.
View 17 Replies
View Related
Jan 7, 2013
is there any way I can remove calendar icon from date picker?
View 2 Replies
View Related
Sep 19, 2011
As I was observing the space issues on my db server. I found that there is lots of Trm and Trc file which is being created very much frequently. Due to this its consuming lots of space even the size of each files is not more than 1Mb.
For cleaning I am deleting all the trm and trc files mannully using DEL command Os level. How can i schedule the purging of trm and trc files.
View 3 Replies
View Related
Mar 30, 2012
I'm trying to remove whitespaces from user input of an ArrayList.
.trim() method for String, but what's the method for ArrayList?
View 1 Replies
View Related
Mar 14, 2012
I need to remove dblink from the existing system .But problem is if we remove the Dblink then how come we can access the remote db's data.
Is there any effective way to select the data from remote db. without using dblink.
View 4 Replies
View Related
Sep 15, 2011
Actually, i found that some forms if they are changed (like some buttons/text fields/code added to them) and this change can be saved and there is no errors in compilation. but when this form is run from the application, the change is not visible.
Even if the form with the image is removed from the directory, it still runs from the application link. Is there some memory issue or anything else.
View 2 Replies
View Related
Feb 20, 2013
This package is generating excel file which contains cursor result.In excel data is populated like below.Column name is Zip_code .My concern is how to remove that single quote from excel file.
eg:
Zip_
'01234
'12567
'23432
'00234
create or replace
PACKAGE BODY PKG_MONTH_END_AUTOMATION AS
PROCEDURE PROC_ZIP_CODE_MONTHEND (directoryOrPath IN VARCHAR2 default 'LOC_PHASE1_WHOUSE_SALES_ADMIN')
[code]...
-- main body
BEGIN
-- Generating Zip Files
SELECT last_day(add_months(sysdate,-1))
INTO v_last_date
[code]...
View 6 Replies
View Related
Aug 10, 2011
when am trying to use nvl for one condition it is taking lot of time to execute but when am removing nvl function then the query executing in 2 min. condition is given below
(HOI2.ORG_INFORMATION1)=nvl(TO_CHAR(:p_set_of_books_id) , HOI2.ORG_INFORMATION1)
but when am using the same condition as below the querry executing in 2 min
(HOI2.ORG_INFORMATION1)=TO_CHAR(:p_set_of_books_id)
my query given below
(SELECT cust.customer_number cust_no, cust.customer_name customer,
cnv.item_no, SUM(wd.shipped_quantity) shp_qty_nos,
0 rtn_qty_nos,
ROUND(SUM(cnv.cnf * wd.shipped_quantity), 3) shp_qty_tons,
0 rtn_qty_tons, 0 net_shp_qty_nos, 0 net_shp_qty_tons
[code]...
View 30 Replies
View Related
Jul 29, 2010
I spool an output using the following script and get a final carriage return at the end. This fails our SSIS bulk insert task. Sample below:
SET SPACE 0
SET HEAD OFF
SET FEEDBACK OFF
SET TERMOUT OFF
set echo off
set newpage 0
set space 0
set pagesize 0
[code]....
View 13 Replies
View Related