Commit 16bda2f0 authored by Frits Hoogland's avatar Frits Hoogland

added my ts test schema as optional install

parent 7b6a02c3
......@@ -22,10 +22,11 @@
- sample_schemas_tablespace: sample
- tools_directory: /home/oracle/tools
- pin_source: https://software.intel.com/sites/landingpage/pintool/downloads/pin-3.7-97619-g0d0c92f4f-gcc-linux.tar.gz
- test_schema_ts_tablespace: ts
pre_tasks:
- name: prevent run without tags
fail: msg="You must run this playbook with tags (create_database,remove_database,install_slob,install_sample_schemas,install_tools,install_pin)"
fail: msg="You must run this playbook with tags (create_database,remove_database,install_slob,install_sample_schemas,install_tools,install_pin,install_test_schema_ts)"
- import_tasks: setup_facts.yml
tags: always
......@@ -36,3 +37,4 @@
- { role: install_sample_schemas, tags: install_sample_schemas }
- { role: install_tools, tags: install_tools }
- { role: install_pin, tags: install_pin }
- { role: install_test_schema_ts, tags: install_test_schema_ts }
---
- name: create ts tablespace
shell:
echo "create bigfile tablespace {{ test_schema_ts_tablespace }} datafile size 100m autoextend on next 100m maxsize unlimited;" | {{ oracle_home }}/bin/sqlplus / as sysdba
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ database_name }}"
- name: run ts schema install
shell: |
echo "
create bigfile tablespace ts datafile size 100m autoextend on next 10m maxsize unlimited;
create user ts identified by ts default tablespace ts temporary tablespace temp quota unlimited on ts;
grant create session, create table to ts;
grant select on v_$mystat to ts;
grant alter session to ts;
--dbms_stats.display_cursor
grant select on v_$session to ts;
grant select on v_$sql_plan to ts;
grant select on v_$sql to ts;
--connect as ts and create sample tables
conn ts/ts
exec dbms_random.seed('abracadabra');
create table t1
as
with generator as (
select rownum id
from dual
connect by
rownum <= 1000
)
select
rownum id,
trunc((rownum-1)/50) clustered,
mod(rownum,20000) scattered,
trunc(dbms_random.value(0,20000)) randomized,
trunc(sysdate) + dbms_random.value(-180, 180) random_date,
dbms_random.string('l',6) random_string,
lpad(rownum,10,0) vc_small,
rpad('x',100,'x') vc_padding
from
generator g1,
generator g2
where
rownum <= 1000000
;
exec dbms_stats.gather_table_stats(null,'T1');
create unique index t1_pk_ix on t1 ( id );
alter table t1 add (constraint t1_pk primary key ( id ) using index t1_pk_ix);
exec dbms_stats.gather_table_stats(null,'T1');
--create table t2 without an index
create table t2 as select * from t1;
exec dbms_stats.gather_table_stats(null,'T2');
" | {{ oracle_home }}/bin/sqlplus system/{{ global_password }}
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ database_name }}"
---
- name: list ts tablespace from dba_tablespaces
shell: >
echo "select tablespace_name from dba_tablespaces where tablespace_name = '{{ test_schema_ts_tablespace | upper }}';" | $ORACLE_HOME/bin/sqlplus / as sysdba
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ database_name }}"
register: ts_tablespace_query
changed_when: "'no rows selected' in ts_tablespace_query.stdout"
notify: create ts tablespace
- name: list ts user to see if test schema needs installing
shell: >
printf "set head off feed off pagesize 0\nselect count(*) from dba_users where username = 'TS';" | $ORACLE_HOME/bin/sqlplus -S / as sysdba
environment:
ORACLE_HOME: "{{ oracle_home }}"
ORACLE_SID: "{{ database_name }}"
register: ts_schema_query
changed_when: ts_schema_query.stdout|int == 0
notify: run ts schema install
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment