<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: job to collect oracle tables statistics in a schema.. in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309221#M1463</link>
    <description>&lt;P&gt;The schema and table name have to be in single quotes. In the SAS Macro language you can use the %TSLIT autocall macro to achieve this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the code snippet below:&lt;/P&gt;
&lt;PRE&gt;      execute(
        begin
        DBMS_STATS.GATHER_TABLE_STATS(
        ownname=&amp;gt; %tslit(&amp;amp;_schema),
        tabname=&amp;gt;  %tslit(&amp;amp;&amp;amp;_table&amp;amp;i.),
        cascade =&amp;gt; false);
        end;
      ) by oracle;
&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
    <pubDate>Fri, 04 Nov 2016 10:28:36 GMT</pubDate>
    <dc:creator>BrunoMueller</dc:creator>
    <dc:date>2016-11-04T10:28:36Z</dc:date>
    <item>
      <title>job to collect oracle tables statistics in a schema..</title>
      <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309177#M1453</link>
      <description>&lt;P&gt;Hi, i am asked to create a job with userwritten ,job includes only transformation&amp;nbsp; and no tables ,it should be able to collect stats on oracle tables in a particular schema in sas di.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is the requirement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tables with CMPGN_* like will be included to collect the table stats in RTDMASL schema&lt;BR /&gt;&amp;gt; User written code module will be used to find out the cmpgn_*&amp;nbsp; like tables&lt;BR /&gt;&amp;gt; User written code module will used to loop throgh the tables&amp;nbsp; and collect the table stats&lt;BR /&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro CMPGN_TBL_Stats_Coll;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;connect to oracle (user=RTDMASL password=rtdmasl path='SAS1D' );&lt;BR /&gt;create table cmpntbls as&lt;BR /&gt;select * from connection to oracle&lt;BR /&gt;(&lt;BR /&gt;&amp;nbsp;SELECT&lt;BR /&gt;&amp;nbsp; table_name, owner&lt;BR /&gt;FROM&lt;BR /&gt;&amp;nbsp; all_tables&lt;BR /&gt;&amp;nbsp; where owner='RTDMASL' and table_name like 'CMPGN_%'&lt;BR /&gt;ORDER BY&lt;BR /&gt;&amp;nbsp; owner, table_name&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; disconnect from oracle&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;options symbolgen;&lt;BR /&gt;&lt;BR /&gt;DATA _NULL_;&lt;BR /&gt;SET cmpntbls END=NOMORE;&lt;BR /&gt;CALL SYMPUT&lt;BR /&gt;('_TABLE' || COMPRESS(PUT(_N_,3.)),&lt;BR /&gt;TRIM(table_name));&lt;BR /&gt;call symput ('_schema',owner);&lt;BR /&gt;IF NOMORE then CALL SYMPUT&lt;BR /&gt;('TOT_TAB', PUT(_N_,3.));&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;%DO I=1 %TO &amp;amp;TOT_TAB;&lt;BR /&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;&lt;BR /&gt;connect to oracle (user=RTDMASL password=rtdmasl path='SAS1D' );&lt;BR /&gt;execute(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; begin&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBMS_STATS.GATHER_TABLE_STATS(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ownname=&amp;gt; &amp;amp;_schema,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tabname=&amp;gt;&amp;nbsp; &amp;amp;&amp;amp;_table&amp;amp;i.,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cascade =&amp;gt; false);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;)&amp;nbsp; by oracle;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;disconnect from oracle;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; quit;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%end;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%mend CMPGN_TBL_Stats_Coll;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%CMPGN_TBL_Stats_Coll;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the error message i am getting is :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Line 215: ERROR: ORACLE execute error: ORA-06550: line 1, column 48: PLS-00201: identifier 'RTDMASL' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;please help me with this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 04:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309177#M1453</guid>
      <dc:creator>Sai1</dc:creator>
      <dc:date>2016-11-04T04:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: job to collect oracle tables statistics in a schema..</title>
      <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309194#M1459</link>
      <description>&lt;P&gt;You are getting Oracle errors related to calling an Oracle-specific procedure. Not sure why you use =&amp;gt; on the procedure parameters, why not just = ? Also test by replacing &amp;nbsp;the macro variable references with hard-coded values - I suspect they should be contained in quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will get better help posting just your Oracle-specific code on an Oracle forum.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 06:23:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309194#M1459</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-11-04T06:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: job to collect oracle tables statistics in a schema..</title>
      <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309204#M1461</link>
      <description>&lt;P&gt;Do you not need to quote username and password?&lt;/P&gt;
&lt;P&gt;Anyways, firs decision - which application to use. &amp;nbsp;There is no benefit to wrapping this code in SAS code. &amp;nbsp;Either do the whole thing on Oracle - in which case visit an Oracle forum - or do the whole thing other than the data extract in SAS - i.e. select * from dictionary.columns where ...; Then do your "statistics" in SAS. &amp;nbsp;It is rarely a good idea to drive one application from another when either could do the job on its own.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 08:28:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309204#M1461</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-04T08:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: job to collect oracle tables statistics in a schema..</title>
      <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309208#M1462</link>
      <description>&lt;PRE&gt;
You can use this to get all the schema:

proc sql;
connect to oracle (user=RTDMASL password=rtdmasl path='SAS1D' );
create table cmpntbls as
select * from connection to oracle(ORACLE::SQLTables);
quit;

&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Nov 2016 08:51:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309208#M1462</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-11-04T08:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: job to collect oracle tables statistics in a schema..</title>
      <link>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309221#M1463</link>
      <description>&lt;P&gt;The schema and table name have to be in single quotes. In the SAS Macro language you can use the %TSLIT autocall macro to achieve this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See the code snippet below:&lt;/P&gt;
&lt;PRE&gt;      execute(
        begin
        DBMS_STATS.GATHER_TABLE_STATS(
        ownname=&amp;gt; %tslit(&amp;amp;_schema),
        tabname=&amp;gt;  %tslit(&amp;amp;&amp;amp;_table&amp;amp;i.),
        cascade =&amp;gt; false);
        end;
      ) by oracle;
&lt;/PRE&gt;
&lt;P&gt;Bruno&lt;/P&gt;</description>
      <pubDate>Fri, 04 Nov 2016 10:28:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/job-to-collect-oracle-tables-statistics-in-a-schema/m-p/309221#M1463</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2016-11-04T10:28:36Z</dc:date>
    </item>
  </channel>
</rss>

