Oracle

How can I import a partition from one table into another in Oracle?

烈酒焚心 提交于 2021-02-08 06:09:42
问题 I would like to know if the following steps are possible and how fast this is: Create a partition named part1 in Table A Drop partition part1 in Table B Import the Table A partition part1 into Table B Can you provide me with an example if it is possible indeed? Or any resources I can look at? Note that the tables would have the exact same structure. 回答1: You can do something similar with the ALTER TABLE ... EXCHANGE PARTITION command. This would exchange a single partition with a table that

How can I import a partition from one table into another in Oracle?

丶灬走出姿态 提交于 2021-02-08 06:04:35
问题 I would like to know if the following steps are possible and how fast this is: Create a partition named part1 in Table A Drop partition part1 in Table B Import the Table A partition part1 into Table B Can you provide me with an example if it is possible indeed? Or any resources I can look at? Note that the tables would have the exact same structure. 回答1: You can do something similar with the ALTER TABLE ... EXCHANGE PARTITION command. This would exchange a single partition with a table that

How to use partition name as a parameter in the select statement?

寵の児 提交于 2021-02-08 05:58:47
问题 I have a huge table that I need to transfer into a new table, my resources do not allow me to that and I need to do that by chunking of data like this: DECLARE TYPE prod_tab IS TABLE OF dba_tab_partitions%ROWTYPE; products_tab prod_tab := prod_tab(); start_time number; end_time number; BEGIN SELECT * BULK COLLECT INTO products_tab FROM dba_tab_partitions WHERE table_name = 'TBLX' EXECUTE IMMEDIATE 'TRUNCATE TABLE dba_tab_partitions2'; EXECUTE IMMEDIATE 'TRUNCATE TABLE tbl2'; FOR i in products

Convert Oracle stored procedure using REF_CURSOR and package global variable to Postgresql or MySQL

我是研究僧i 提交于 2021-02-08 05:46:15
问题 This package uses two unique features of Oracle, REF_CURSOR and a package global variable. I would like to port the functionality from Oracle to Postgresql or MySQL. PACKAGE tox IS /*=======================*/ g_spool_key spool.key%TYPE := NULL; TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE; /*=======================*/ PROCEDURE begin_spool; /*=======================*/ PROCEDURE into_spool ( in_txt IN spool.txt%TYPE ); /*=======================*/ PROCEDURE reset_spool; /*====================

Oracle sqlplus comments

巧了我就是萌 提交于 2021-02-08 05:44:23
问题 Why does the following insert statement not work when executed like sqlplus <connect> @file INSERT INTO abc ( a ,b ,c) VALUES ( '1' --a ,'2' --b ,'3'); --c but it works without the comments i.e INSERT INTO abc ( a ,b ,c) VALUES ( '1' ,'2' ,'3'); Does sqlplus flatten the file i.e execute the whole thing on a single line? which might result in rest of the line getting commented out? 回答1: The fist insert statement didn't work only because of the last comment --c you've placed after the statement

ORA-01722: Invalid Number, find specific line

我与影子孤独终老i 提交于 2021-02-08 05:43:25
问题 I have a rather large select which throws the ORA-01722: Invalid Number error. The error itself is clear but I don't know the exact line which throws it. Is there any way to find out the exact line? I don't really want to look through the whole select and compare the types as it would take a very lone time. 回答1: Most SQL clients will report the line and column where the error happened. If you don't have a good IDE handy, use DBMS_SQL . SQL Client Most SQL IDEs will highlight the line and

how to export data from around 300 tables in ORACLE DB to csv or txt files

廉价感情. 提交于 2021-02-08 04:48:03
问题 Is there any possibility to export data from around 300 tables within single schema with millions of records to CSV or TXT using any PL/SQL procedure? What do you propose, which is fastest way to do it? For the moment I do not need to import these exported files to any other schema... I tried with Toad manually exporting table by table... 回答1: you can try following steps. write a loop to get the table names use cursors to fetch the data from each table use SYS.UTL_FILE utilities to write the

对容器镜像的思考和讨论

一世执手 提交于 2021-02-08 04:41:41
简介: 常言道,startup 有 startup 的好,大厂有大厂的好,那么大厂究竟好在哪呢?拿硅谷老牌大厂们 FLG 来说,如果要问最令人怀念的是什么?Free food 和基础设施(Infrastructure)一定是会上榜的,两者均极大提升了广大应用开发者的幸福指数。那么能不能“让天下没有难做的应用”呢?请大家把目光投向正在兴起的云原生生态。 前言 常言道,startup 有 startup 的好,大厂有大厂的好,那么大厂究竟好在哪呢?拿硅谷老牌大厂们 FLG 来说,如果要问最令人怀念的是什么?Free food 和基础设施(Infrastructure)一定是会上榜的,两者均极大提升了广大应用开发者的幸福指数。那么能不能“让天下没有难做的应用”呢?请大家把目光投向正在兴起的云原生生态。 在云原生生态中,容器服务包括了镜像和容器引擎两个部分。其中容器镜像作为核心的云原生应用制品,打包了完整的操作系统和应用运行环境,应用的迭代也因为使用了这种不可变架构而变得更简单,更频繁。 本文将围绕着容器镜像这一核心,分享它的相关知识和业界的思考与实践。 容器镜像的概念 1)容器镜像 容器镜像有一个官方的类比,"生活中常见的集装箱",虽然拥有不同的规格,但箱子本身是不可变的(Immutable),只是其中装的内容不同。 对于镜像来说,不变的部分包含了运行一个应用软件(如 mysql

Added date and modified date for Oracle table audit

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 04:39:35
问题 According to requirenments I need to support two mandatory columns for each table: ADDED_DATE, MODIFIED_DATE. These are intended for DBA/auditing purposes. Is it possible to make this stuff totally automatic, implicitly supported by DB itself when I'm inserting / updating records from within application? 回答1: create a trigger on the table (before update for each row). SQL> create table foo (hi varchar2(10), added_date date, modified_date date); Table created. SQL> create trigger foo_auifer 2

How to tell which partition a row would go into, given a known partition key value in Oracle?

那年仲夏 提交于 2021-02-08 04:38:55
问题 CREATE TABLE foos ( batch_id NUMBER, creation_date DATE ) PARTITION BY RANGE (creation_date) SUBPARTITION BY HASH (batch_id) SUBPARTITION TEMPLATE ( SUBPARTITION H0, SUBPARTITION H1, SUBPARTITION H2, SUBPARTITION H3 ) ( PARTITION R0 VALUES LESS THAN (DATE'2018-04-01') ) ; CREATE INDEX foos_n1 ON foos (batch_id); INSERT INTO foos VALUES (1234, SYSDATE); INSERT INTO foos VALUES (1234, SYSDATE); INSERT INTO foos VALUES (1234, SYSDATE); INSERT INTO foos VALUES (1234, SYSDATE); If I know a batch