Skip to content

Commit 6acbbf9

Browse files
authored
Merge pull request #1675 from todor-ivanov/WMAgent_OracleInteractiveFormating_fix-12460
WMAgent: Avoid altering files in readonly area
2 parents e7be801 + 16d97d0 commit 6acbbf9

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

docker/pypi/wmagent/bin/manage-common.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,12 @@ _connect_oracle(){
9292
local oraHistFile=$WMA_LOG_DIR/.sqlplus_history
9393
local oraDictFile=$ORACLE_PATH/.autocomp.txt
9494
local oraDictFileDBObj=$oraTmpPath/${owner^^}/.autocompDBObj.txt
95-
local prompt="SQL [$ORACLE_USER@$ORACLE_TNS]> "
95+
local prompt="ORA [$ORACLE_USER@$ORACLE_TNS]> "
9696
touch $oraHistFile
97-
touch $oraDictFile
9897
touch $oraDictFileDBObj
9998

10099
# Starting the interactive session:
101-
rlwrap -U --always-readline --no-children -H $oraHistFile -pgreen -S "$prompt" -z pipeto -D2 -i -r -c -f $oraDictFileDBObj -f $oraDictFile -f . -- sqlplus $connStr @login "${owner^^}" "${oraTmpPath}" "$oraDictFileDBObj"
100+
rlwrap -U -H $oraHistFile -pgreen -S "$prompt" -z pipeto -D2 -i -r -c -f $oraDictFileDBObj -f $oraDictFile -f . -- sqlplus $connStr @login "${owner^^}" "${oraTmpPath}" "$oraDictFileDBObj"
102101
}
103102

104103
_exec_oracle() {

docker/pypi/wmagent/etc/oracle/login.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,12 @@ set verify ON
118118
--set wrap ON
119119
set xmloptimizationcheck OFF
120120

121-
-- setup/run/define dbs-inventory related scripts and variables
122-
define _editor=emacs
121+
-- setup/run/define interactive db sessions related scripts and variables
122+
-- define _editor=emacs
123123
define owner=&1
124124
define oracle_tmp_path=&2
125125
define db_obj_autocomp=&3
126+
@stats_refresh
126127
@col_width_all
127128
@fill_db_obj_autocomp
129+
set editfile &oracle_tmp_path/afiedt.buf
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
SET SERVEROUTPUT ON
2+
set FEEDBACK OFF
3+
declare
4+
print_line varchar2(2048);
5+
begin
6+
for i in (select table_name, stale_stats from user_tab_statistics
7+
where (stale_stats is null)) loop
8+
-- refresh statistis for stale tables as well
9+
-- where stale_stats is null or stale_stats='YES') loop
10+
print_line:='Refreshing statistics for table: '||i.table_name;
11+
dbms_output.put_line(print_line);
12+
dbms_stats.gather_table_stats(ownname=>NULL, tabname=>i.table_name, cascade=>FALSE);
13+
end loop;
14+
end;
15+
/

0 commit comments

Comments
 (0)