Skip to content

Commit ea4d755

Browse files
Mikael SandströmMikael Sandström
authored andcommitted
Updated profile handling for databases
1 parent e918f75 commit ea4d755

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

oradb-create/tasks/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
with_items: oradbcreate.results
4545
tags:
4646
- oradbcreate
47+
when: oradbcreate.changed
4748

4849
# - name: Add default services to databases
4950
# shell: "{{ oracle_home_db }}/bin/srvctl add service -db {{ item.value.oracle_database }}
@@ -65,7 +66,26 @@
6566
# when: oracle_install_option_gi == 'CRS_CONFIG' or oracle_install_option_gi == 'HA_CONFIG'
6667
# tags:
6768
# - srvctlconfig
69+
- name: Add dotprofile (1)
70+
shell: ps -ef | grep "ora_pmon_{{ item.oracle_db_name }}" |grep -v grep | sed 's/^.*pmon_//g'
71+
with_items: oracle_databases
72+
register: dbs
73+
tags: dotprofile_db
74+
75+
- name: Add dotprofile (2)
76+
template: src=dotprofile-db.j2 dest={{ oracle_user_home }}/.profile_{{ item.0.oracle_db_name }} owner={{ oracle_user }} group={{ oracle_group }} mode=775 backup=yes
77+
with_together:
78+
- oracle_databases
79+
- dbs.results
80+
tags: dotprofile_db
6881

82+
- name: Update oratab
83+
lineinfile: dest=/etc/oratab line="{{ item.1.stdout }}:{{ oracle_base }}/{{ item.0.oracle_version_db }}/{{ item.0.home }}:N" state=present
84+
with_together:
85+
- oracle_databases
86+
- dbs.results
87+
tags: update_oratab
88+
6989
- name: Check if database is running
7090
shell: ps -ef |grep pmon |grep -v grep
7191
tags:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# {{ ansible_managed }}
2+
#
3+
export PS1='[$LOGNAME'@'$ORACLE_SID `basename $PWD`]$'
4+
5+
6+
# Set up the Oracle parameters
7+
umask 022
8+
ORACLE_BASE={{ oracle_base }}
9+
export ORACLE_BASE
10+
ORACLE_HOME="{{ oracle_base }}/{{ item.0.oracle_version_db }}/{{ item.0.home }}"
11+
export ORACLE_HOME
12+
NLS_LANG=american_america.al32utf8
13+
export NLS_LANG
14+
ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
15+
export ORA_NLS33
16+
SHLIB_PATH=$ORACLE_HOME/lib
17+
export SHLIB_PATH
18+
LD_LIBRARY_PATH=$ORACLE_HOME/lib
19+
export LD_LIBRARY_PATH
20+
TNS_ADMIN=$ORACLE_HOME/network/admin
21+
export TNS_ADMIN
22+
SQLPATH=/home/oracle/.Scripts
23+
export SQLPATH
24+
ORACLE_SID={{ item.1.stdout }}
25+
export ORACLE_SID
26+
export ORA_DB_UNQ_NAME=
27+
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
28+
29+
30+
31+
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH:$SQLPATH:$GG_HOME/
32+
33+
34+
# Set Up Aliases:
35+
alias asmcmd='. oraenv ;rlwrap asmcmd -p'
36+
#alias sqlplus='rlwrap -D2 -s 1000 -irc -b'\''"@(){}[],+=&^%#;|\'\'' -f ~/.Scripts/tanel/tpt_public_unixmac/setup/wordfile_11gR2.txt sqlplus'
37+
alias sqlplus='rlwrap sqlplus'
38+
alias rman='rlwrap rman'
39+
alias sid='. oraenv'
40+
alias sqlp='. oraenv; sqlplus'
41+
#alias sqlsys='. oraenv ;rlwrap -D2 -irc -b'\''"@(){}[],+=&^%#;|\'\'' -f ~/.Scripts/tanel/tpt_public_unixmac/setup/wordfile_11gR2.txt sqlplus "/ as sysdba"'
42+
alias sqlsys='. oraenv ;rlwrap sqlplus "/ as sysdba"'
43+
alias dbh='cd $ORACLE_HOME'
44+
alias dbb='cd $ORACLE_BASE'
45+
alias c='clear'
46+
alias talert='tail -200f $ORACLE_BASE/diag/rdbms/$ORA_DB_UNQ_NAME/$ORACLE_SID/trace/alert_$ORACLE_SID.log'
47+
alias ggsci='rlwrap $GG_HOME/ggsci'
48+

0 commit comments

Comments
 (0)