-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ca32a7
commit 5a68ca2
Showing
6 changed files
with
134 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
REM pstreeselect_interval_partitioning.sql | ||
|
||
set echo on | ||
REM spool &&2._pstreeselect&&1._interval_partitioning | ||
spool pstreeselect_interval_partitioning append | ||
|
||
ALTER SESSION SET CURRENT_SCHEMA=&&2.; | ||
|
||
DROP TABLE &&2..PSYPSTREESELECT&&1. PURGE | ||
/ | ||
|
||
CREATE TABLE &&2..PSYPSTREESELECT&&1. | ||
(SELECTOR_NUM INTEGER NOT NULL, | ||
TREE_NODE_NUM INTEGER NOT NULL, | ||
RANGE_FROM_&&1. VARCHAR2(&&1.) NOT NULL, | ||
RANGE_TO_&&1. VARCHAR2(&&1.) NOT NULL) | ||
PARTITION BY RANGE (selector_num) INTERVAL (1) | ||
(PARTITION VALUES LESS THAN(2)) | ||
TABLESPACE "PTWORK" STORAGE(INITIAL 64K NEXT 64K) | ||
/ | ||
INSERT INTO &&2..PSYPSTREESELECT&&1. | ||
(SELECTOR_NUM, | ||
TREE_NODE_NUM, | ||
RANGE_FROM_&&1., | ||
RANGE_TO_&&1.) | ||
SELECT SELECTOR_NUM, | ||
TREE_NODE_NUM, | ||
RANGE_FROM_&&1., | ||
RANGE_TO_&&1. | ||
FROM &&2..PSTREESELECT&&1. | ||
/ | ||
|
||
DROP TABLE &&2..PSTREESELECT&&1. PURGE; | ||
/ | ||
ALTER TABLE &&2..PSYPSTREESELECT&&1. RENAME TO PSTREESELECT&&1. | ||
/ | ||
|
||
CREATE UNIQUE INDEX &&2..PS_PSTREESELECT&&1. ON &&2..PSTREESELECT&&1. | ||
(SELECTOR_NUM | ||
,TREE_NODE_NUM | ||
,RANGE_FROM_&&1. | ||
,RANGE_TO_&&1.) | ||
local PCTFREE 5 COMPRESS 1 TABLESPACE "PSINDEX" STORAGE(INITIAL 64K NEXT 64K) | ||
/ | ||
ALTER INDEX &&2..PS_PSTREESELECT&&1. NOPARALLEL LOGGING | ||
/ | ||
CREATE INDEX &&2..PSAPSTREESELECT&&1. ON &&2..PSTREESELECT&&1. | ||
(SELECTOR_NUM | ||
,RANGE_FROM_&&1. | ||
,RANGE_TO_&&1. | ||
,TREE_NODE_NUM) | ||
local PCTFREE 5 COMPRESS 1 TABLESPACE "PSINDEX" STORAGE(INITIAL 64K NEXT 64K) | ||
/ | ||
ALTER INDEX &&2..PSAPSTREESELECT&&1. NOPARALLEL LOGGING | ||
/ | ||
|
||
--add your own roles here | ||
GRANT SELECT ON &&2..pstreeselect&&1. TO sysadm; | ||
GRANT SELECT ON &&2..pstreeselect&&1. TO ps_read_all_role; | ||
GRANT SELECT ON &&2..pstreeselect&&1. TO ace_read_only; | ||
GRANT SELECT ON &&2..pstreeselect&&1. TO psteam; | ||
GRANT SELECT, INSERT, UPDATE, DELETE ON &&2..pstreeselect&&1. TO ace_read_write; | ||
|
||
spool off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
REM rebuild_interval_treeselector.sql | ||
set pages 0 head off feedback off echo off | ||
spool pstreeselect_interval_partitioning | ||
spool C:\Users\DAKURT0\Documents\sql\rebuild_interval_treeselector1.sql | ||
with u as ( | ||
SELECT username | ||
FROM dba_users | ||
WHERE (username = 'SYSADM' OR username like 'NVEXEC%') | ||
), r as ( | ||
SELECT recname, DECODE(sqltablename,' ','PS_'||recname,sqltablename) sqltablename | ||
, SUBSTR(recname,-2) n | ||
FROM psrecdefn | ||
WHERE recname like 'PSTREESELECT__' | ||
) | ||
SELECT '@@C:\Users\DAKURT0\Documents\sql\pstreeselect_interval_partitioning.sql', r.n, u.username | ||
FROM u, r | ||
--WHERE r.n = 1 | ||
ORDER BY r.n, u.username | ||
--FETCH FIRST 10 ROWS ONLY | ||
/ | ||
spool off | ||
set pages 99 head on feedback on echo on verify on | ||
spool rebuild_interval_treeselector | ||
clear screen | ||
alter session set current_schema = SYSADM; | ||
EXEC sysadm.psft_Ddl_lock.set_Ddl_permitted(true); | ||
@@C:\Users\DAKURT0\Documents\sql\rebuild_interval_treeselector1 | ||
EXEC sysadm.psft_Ddl_lock.set_Ddl_permitted(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters