Wednesday, July 12, 2023

SAS VIYA The SAS CAS Management service is unavailable or could not be found.

 sas-viya --output text cas caslibs list --su --limit 200 

sas-viya --output text cas servers list

These commands gave me : 

"The SAS CAS Management service is unavailable or could not be found."


After some research I found out that my sas-endpoint url contained a "/" at the end.

Removing the / was the solution.


For example : 

$ sas-viya --profile dikpater profile init

Enter configuration options:

Service Endpoint> https://sasviya.example.nl      !!!!NOSLASHATTHEEND!!!

Output type (text|json|fulljson)> text

Enable ANSI colored output (y/n)?>

Saved 'dikpater' profile to /appl/homedir/sas/.sas/config.json.

$ sas-viya --profile dikpater profile show

Current settings for the [dikpater] profile:

Setting               Current Value

oauth-client-id       sas.cli

output                text

sas-endpoint          https://sasviya.example.nl

ansi-colors-enabled   false



Thursday, May 4, 2023

list size of tables in cas memory sas viya.

/* most of the code is somewhere borrowed, can't remember the exact site anymore */ 


options nonotes;

cas adminsession;

caslib _all_ assign;


proc cas;

/* need to be a super user */

accessControl.assumeRole / adminRole="superuser";

accessControl.accessPersonalCaslibs;

table.caslibinfo result=fileresult;

casliblist=findtable(fileresult);


/* loop caslibs */

SumDataSize=0;

SumCompressedSize=0;

SumMappedMemory=0;


do cvalue over casliblist;


if cvalue.name!=: 'demoCASUSER' then

do;


/* only look at caslibs that contain CASUSER */

table.tableinfo result=tabresult / caslib=cvalue.name;

tablelist=findtable(tabresult);

x=dim(tablelist);


if x>1 then

do;


/* there are tables available */

do tvalue over tablelist;


/* loop all tables in the caslib */

/* table.droptable / caslib="casuser" name="tableinfo"; */

table.tabledetails result=r / caslib=cvalue.name name=tvalue.name;


/* table.tableinfo / caslib=cvalue.name name=tvalue.name; */

val=findtable(r);

saveresult val caslib="CASUSER" casout="tableinfo" replace;


do xvalue over val;


/*  */

/* print (xvalue.DataSize); */

/* SumDataSize=0 ; */

SumDataSize=SumDataSize+xvalue.DataSize;

SumCompressedSize=SumCompressedSize+xvalue.CompressedSize;

SumMappedMemory=SumMappedMemory+xvalue.MappedMemory;


/* print cvalue.name, tvalue.name, xvalue.CompressedSize, "SumDataSize:" SumDataSize; */

print "INFO-001: LIBRARY: " cvalue.name " :tabel :" tvalue.name 

":DataSize :" xvalue.DataSize ":CompressedSize :" 

xvalue.CompressedSize ":AllocatedMemory : " xvalue.AllocatedMemory 

": Creator : " tvalue.creator;


/* print xvalue;   */

/* print tvalue; */

/* print cvalue; */

end;


/* print(r); */

/* describe(r); */

/* data CASUSER.tableinfo_total  ; */

/* set   CASUSER.tableinfo_total CASUSER.tableinfo; */

/*  table.append /  */

/*     source={caslib='CASUSER',name='tableinfo'} */

/*     target={caslib='CASUSER',name='tableinfo_total'}; */

end;


/* loop all tables in the caslib */

end;


/* there are tables available */

end;


/* only look at caslibs that contain CASUSER */

end;


/* loop caslibs */

print "INFO-001:SumDataSize :" round(SumDataSize/1024/1024) "MB";

print "INFO-001:SumCompressedSize :" round(SumCompressedSize/1024/1024) 

"MB";

print "INFO-001:SumMappedMemory : " round(SumMappedMemory/1024/1024) "MB";

accessControl.dropRole / adminRole='superuser';

quit;


cas adminsession terminate;

sas viya cas cache cascache disk usage history

 

cas sess1; 

caslib _all_ assign;


%let BASE_URI=%sysfunc(getoption(servicesbaseurl)) ;

 


/* proc casutil outcaslib="CASUSER" ; */

/*    load data=  path="dfcascachehistory.sashdat"; replace;   */



proc cas;

/* table.dropTable / table="dfcascachehistory";   */


  table.loadTable /

    path="dfcascachehistory.sashdat"

    casout={name="dfcascachehistory"} ;

    

  table.fileInfo /                                                /* 1*/

    path="dfcascachehistory.sashdat";

quit ;




proc cas; 

    session sess1; 

    accessControl.assumeRole / adminRole="superuser";       

    builtins.getCacheInfo result=results; 

    describe results  ;  

run;



SAVERESULT results dataout=dfcascache ;  




data casuser.dfcascache_with_date; 

set dfcascache;

format datum ddmmyy10. ;

  datum=date();

run;


data casuser.dfcascachehistory ( append=yes ) ;

set  casuser.dfcascache_with_date;

run;


proc contents data=casuser.dfcascachehistory ;

run; 


proc cas;

  table.save /

    table="dfcascachehistory"

    name="dfcascachehistory.sashdat"

    replace=True;

    

  table.fileInfo /  path="dfcascachehistory.sashdat";

quit ;






options 

  emailsys=smtp 

  emailhost=

(

"MAILSERVERNAME.nl"

STARTTLS auth=LOGIN

/* your Outlook address */

id=USERNAME@SOMESITE.NL

/* optional: encode PW with PROC PWENCODE */

pw={SAS002}ABCDEFGHI port=25

)

;

/* Small SAS job to produce some data */


filename msg email 

 to="sasuser@somesite.nl"

from="no_reply@somesite.nl"

type='text/html'

subject = "DDS-INFO-001:DFCASCACHE &base_uri"; 

ods graphics / imagefmt=png height=800 width=800;

ods html5 (id=mail) file=msg style=htmlblue options(bitmap_mode="inline") gtitle;

ods escapechar='^';

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Goededag ,";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Bijgaand de cascache informatie";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black}Vriendelijke groeten,";

ODS TEXT="^S={font_face='Calibri' font_size=3 fontweight=Medium foreground=black} ";


 

proc print data=dfcascache noobs

 style (table) = [frame=box borderwidth=1 ];

;

/* VAR sex name age; */

TITLE1 "DISK USAGE CAS CACHE ";

Footnote1 "&_sasprogramfile";

Footnote2 "2023 &BASE_URI";


run;


proc print data=casuser.dfcascachehistory noobs

 style (table) = [frame=box borderwidth=1 ];

;

run;

proc sgplot data=casuser.dfcascachehistory;


title "Graph of FS_USAGE, by Node";


series x=datum y=FS_USAGE /markers group=Node;


/* keylegend /location=outside position=top; */

keylegend /position=top;


run;



ods html5 (id=mail) close;


cas sess1 terminate;



Thursday, December 23, 2021

perl_socket test port

 

#########################################################

# perl_socket.pl                                        #

# run at your own risk ;-) Dik Pater 12-feb-2016        #

#########################################################

print "############################################################################\n";

print "perl_socket:INFO: DONOT RUN IN BACKGROUND ALWAYS TERMINATE AFTER TESTING !! \n";

print "perl_socket:INFO: DONOT RUN IN BACKGROUND ALWAYS TERMINATE AFTER TESTING !! \n";

print "perl_socket:INFO: DONOT RUN IN BACKGROUND ALWAYS TERMINATE AFTER TESTING !! \n";

print "############################################################################\n";

print ;

use IO::Socket;

my ($hostname, $portnumber) = @ARGV;

if (not defined $hostname) {

  die "Need hostname\n";

}

if (defined $portnumber) {

print "############################################################################\n";

print "perl_socket:INFO testing '$hostname' and '$portnumber'\n";

print "perl_socket:INFO goto other system and perform \n";

print "perl_socket:INFO telnet $hostname $portnumber\n";

print "############################################################################\n";

}

 

 my $sock = new IO::Socket::INET (

                                  LocalHost => $hostname,

                                  LocalPort => $portnumber,

                                  Proto => 'tcp',

                                  Listen => 1,

                                  Reuse => 1,

                                 );

 die "Could not create socket: $!\n" unless $sock;

my $new_sock = $sock->accept();

while(<$new_sock>) {

print $_;

}

close($sock);

Friday, October 22, 2021

SAS VIYA unsupported protocol scheme

 


/opt/sas/viya/home/bin/sas-admin compute credentials list

Failed to list the shared service account credentials. Reason: 1 error occurred:

  * Get /credentials/domains?filter=eq(type,'compute-password')&sortBy=label&limit=10: unsupported protocol scheme ""


/opt/sas/viya/home/bin/sas-admin --sas-endpoint="https://<VIYASITE>.nl" compute credentials list


Or set your endpoint

or set your endpoint with a environment variable $SAS_SERVICES_ENDPOINT

SAS SAML samesite cookie sas.commons.web.security.cookies InResponseToField of the Response doesn't correspond to sent message

We configured saml login in sas viya.

We got the message : "InResponseToField of the Response doesn't correspond to sent message <messageid>

Generating new saml metadata file .... still receiving error.

Rebooted the server, You Never Know ;-) ... still receiving error.

We als saw this in the saslogon logging : 

Cannot determine identity zone, UAA is catch-all domain for host: <OURVIYAHOST>

The Solution for the problem with "InResponseToField of the Response doesn't correspond to sent message" was to configure sameSite to None


 



Wednesday, January 20, 2021

Model Studio displays "The data advisor failed to run on the selected data source

 

Problem Note 62923: Model Studio displays "The data advisor failed to run on the selected data source


I could create a new project with data.
I could test perfect.
Until I got the above error.
Did we change something ???
No....
hmmmm
ok I removed my os-account on the viya server...yesterday.
Just a useradd  and it works again.

We will use service accounts also for data-mining.

See how to do that : 


Regards,

Dik Pater.


Tuesday, December 8, 2020

SAS VIYA : sas.identities.providers.ldap.connection pool.whenexhausted type must be integer in GUI

Error is : 

 Het type "string" is ongeldig voor de eigenschap "pool.whenExhaustedAction". Het type moet "integer" zijn

Solve with : 

/appl/sas/viya/home/bin/sas-admin configuration configurations download --target /tmp/ldapconnection.json  --definition-name sas.identities.providers.ldap.connection  --service identities

Write is complete to "/tmp/ldapconnection.json".

$ vi /tmp/ldapconnection.json

ADJUST the value from 1 in 2.


$ /appl/sas/viya/home/bin/sas-admin configuration configurations update --file /tmp/ldapconnection.json

"PATCH" "/configuration/configurations" complete from "/tmp/ldapconnection.json".


Monday, September 21, 2020

memsize in sas viya

For testing purposes I edited : 

/appl/sas/viya/config/etc/compsrv/default/sasv9_usermods.cfg

 added 

-memsize 0 

this resulted in a maximum in my case :

 MEMSIZE=47322067200

  No restart was necessary, just a new cas session.

Wednesday, December 11, 2019

filesize powershel script

$logfile="d:\batch\filesize.csv"
$dirs='c:\temp', 'd:\batch'
$size = 0
$datum=Get-Date -Format "yyyyMMdd"
foreach ($file in (get-childitem -path $dirs -file)) {
$file.FullName + "," + $file.Length + "," + $datum | out-file -filepath  $logfile -append }

commandline oracle bipublisher login and clear cache , java nullpointer calling xmlpserver java.lang.NullPointerException wwv_flow_webservices_api.make_request



OBIEE 12c: How to Clear the BI Presentation Service Cache with Command Line  (Doc ID 2468367.1) DID NOT WORK for me, it cleared the presentation cache , but we were looking for a clear of the BIPUBLISHER CACHE.

The problem was that when we restarted the bi_server1 the webservice to schedule a request gave a java nullpointer exception, WE DO THIS FROM APEX STORED PROCEDURE IN A DATABASE.
When we pushed the button naar http://servernaam:8080/analytics , kies beheer, bi publisher beheren, cache beheren, objectcache wissen ( translated goto management, manage bi publisher, manage cache, clear object cache) it was all working again..
But this was not the real solution...or should I say cause...
It was enough to just go to the admin page.
We automated this with the following curl statements : 

curl -v -X "POST" "http://SERVERNAME:8080/bi-security-login/login" --data "j_username=weblogic&j_password=TOPSECRET" --cookie-jar "cookies.txt"
curl -v http://SERVERNAME:8080/xmlpserver/servlet/admin --cookie "cookies.txt" --cookie-jar "cookies.txt"

After the start.sh we called these statements in a script ...
Now we don't have a problem with calling the webservice from apex to print our pdf's.

wwv_flow_webservices_api.make_request(
    p_url => l_url,
    p_envelope => l_env );

Regards ,
Dik Pater

Friday, March 30, 2018

impdp hang

If your impdp hangs....
I use ctrl-c.
status ....
somestate returns
status ....
somestate returns again unchanged.
don't do kill_job !
don't do stop_job !
But look in the view dba_resumable......
There it is : unable to extend tablespace x or tablespace temp...
Alter database datafile 'x' autoextend on maxsize 64G ;
in impdp prompt you can now enter CONTINUE_CLIENT.
The output will continue again.
And in the best case your import will continue.


Happy Easter !


Dik



Friday, November 3, 2017

reset password of apex user.

set echo off
set verify off
undefine workspace
undefine newwachtwoord
undefine USERNAAM
prompt geef TRUE of FALSE op bij de CHANGE_PASSWORD_ON_FIRST_USE
begin
    wwv_flow_api.set_security_group_id (p_security_group_id => apex_util.find_security_group_id(upper('&&workspace')));
for user_rec in (
select user_id, user_name
from WWV_FLOW_USERS
where security_group_id = ( select apex_util.find_security_group_id('&&workspace') from dual )
and upper(user_name) = upper('&&USERNAAM')
)
loop
    APEX_UTIL.RESET_PASSWORD(
        p_user_name => upper('&&USERNAAM'),
P_NEW_PASSWORD => '&&newwachtwoord',
P_CHANGE_PASSWORD_ON_FIRST_USE=> &CHANGE_PASSWORD_ON_FIRST_USE);
end loop;
exception when others then raise ;
end ;
/
prompt &&USERNAAM wachtwoord is geworden &&newwachtwoord
prompt geef commit of rollback

throughput of expdp

while true
do
prev=`ls -l *.dmp | awk '{a+=$5}END{printf("%.0f\n",a/1024/1024)}'`
sleep 60
next=`ls -l *.dmp | awk '{a+=$5}END{printf("%.0f\n",a/1024/1024)}'`
doorloop=`expr $next - $prev`
echo $next $prev $doorloop
done

Tuesday, October 17, 2017

EM12c and EM13c datasources report.



SELECT
        *
FROM
        (
                SELECT
                        'CONNECTIONPOOLS',
                        s4.cm_target_name,
                        s4.URL
                FROM
                        CM$MGMT_OC4J_CONNECTIONPOOLS s4
               
                UNION ALL
               
                SELECT
                        'MANAGED DATASOURCE',
                        s3.cm_target_name   ,
                        s3.URL
                FROM
                        CM$MGMT_OC4J_DATASOURCES s3
               
                UNION ALL
               
                SELECT
                        'NATIVE'         ,
                        s5.cm_target_name,
                        s5.URL
                FROM
                        CM$MGMT_OC4J_NATIVEDATASOURCES s5
        )
        sel

Monday, September 25, 2017

workspace export in sqldeveloper with apex 3.2.1 runtime

From sqldeveloper you can export the workspace in a runtime environment in apex 3.2.
Just did a trace in our DVL environment, this was executed.
In sqldeveloper just put in the code , activate OWA output from view -> owa output :


NOTE replace :WORKSPACE with your workspace.


declare
  l_orig_sgid number := wwv_flow_security.g_security_group_id;
begin
  for c1 in (select provisioning_company_id
    from wwv_flow_companies
    where short_name = upper(':WORKSPACE')) loop
    wwv_flow_security.g_security_group_id := c1.provisioning_company_id;
  end loop;
  --
--  htp.init;
  wwv_flow.g_page_text_generated := true;
  wwv_flow_fnd_user_api.g_mime_shown := true;
  owa_util.mime_header('application/x-sql',false);
  htp.p('Content-Disposition: attachment; filename='|| wwv_flow_utilities.escape_url(p_url => ':WORKSPACE', p_url_charset => 'utf-8') ||'.sql');
  owa_util.http_header_close;
  --
  wwv_flow_fnd_user_api.export_fnd_users(p_export_format=>'UNIX');
  --
  wwv_flow.g_page_text_generated := true;
  wwv_flow.g_unrecoverable_error := true;
  wwv_flow_security.g_security_group_id := l_orig_sgid;
  --
exception when others then
  wwv_flow_security.g_security_group_id := l_orig_sgid;
  raise;
end;
/


Select 'greetings from dik pater ' from dual ;

Monday, April 24, 2017

keepass keeppass slow on opening files

We solved this by View -> disable Show Entries of Subgroups , 2 seconds opening now , instead of minutes !

Monday, January 30, 2017

Regexp replace until space sed regular expression

I asked my collegues how to replace until next space with sed.
They solved it for me.
sed -i 's/password=[^[:space:]]*/password=geenpassword/g' test.txt

I had to blog this excellent answer.
Thanks to Danny and Frank for solving this.

Btw.
I used awk for this.
But that was not the sed solution.


{for (i=1; i <= NF; i++) { if ($i !~ /password/) {printf($i" ") ;}
                           else {printf("GEHEIM ")}if(i==NF){printf("\n")}}}

Monday, October 10, 2016

oem 13c firefox flash performance tab not working

In the default downloaded image oem 13c from otn Firefox performance page was not working.
I downloaded the latest version of flash libflashplayer.so from adobe http://labs.adobe.com/downloads
I choosed:
https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/libflashplayer.so


I copied this file to /usr/lib/mozilla/plugins
after that I installed flash-plugin-11.2.202.635-release.x86-64.rpm.
rpm -ivh flash-plugin-11.2.202.635-release.x86-64.rpm


I restarted Firefox and OEM 13C Performance tab was working !

Thursday, December 24, 2015

brief technical note on images export import to new apex 41 database from hpux 11gr2 to linux 11gr2

We created a database on our new platform, installed apex in it with apexins.sql

Then we made a full export, we imported everything except apex_040100 user
 
Next we created workspaces and applications in the new environment.
We exported these workspace and applications with scripting from the internet.
the apexexport utility in apex41 gave empty files as a result.

INFO APEXEXport

$ cd ..apex41/apex/utilities
$ export CLASSPATH=.:${ORACLE_HOME}/oui/jlib/classes12.jar
$ read wachtwoord
# exporteer eerst de WORKSPACES middels test_export
$ java  oracle.apex.APEXExport -db  HOSTNAME:1521:DATABASE_SERVICE -user system -password $wachtwoord -instance

Gave me the export of the applications
But the workspace files were empty, THIS is a bug.

https://apexplained.wordpress.com/2012/03/20/workspace-application-and-page-export-in-plsql/

I used to export the workspaces.
I installed the procedures and then used :

REM desc PRO_EXPORT_WORKSPACE
REM PROCEDURE PRO_EXPORT_WORKSPACE
REM  Argument Name                  Type                    In/Out Default?
REM  ------------------------------ ----------------------- ------ --------
REM  P_WORKSPACE_ID                 NUMBER                  IN
REM  P_INCLUDE_TEAM_DEV             BOOLEAN                 IN
REM  P_ORA_DIR                      VARCHAR2                IN
REM
REM MY_ORA_DIR
REM
col workspace_id format 999999999999999999
declare
cursor c_ws is
select workspace_id from apex_workspaces where workspace_id > 11 ;
r_ws c_ws%rowtype ;
begin
 for r_ws in c_ws
 loop
   PRO_EXPORT_WORKSPACE( r_ws.workspace_id , TRUE,'MY_ORA_DIR') ;
 end loop ;
end;
/


We exported the source data with datapump to file dp_EVERYTHING_%U.dmp

expdp full=y DIRECTORY=EXP_DB DUMPFILE=dp_EVERYTHING%u LOGFILE=EXP_DB:dp_EVERYTHING.log FILESIZE=20G PARALLEL=4 FLASHBACK_TIME=SYSTIMESTAMP
We created a database directory called IMP_DB in the target database.

$ cat images_impdp.par

DUMPFILE=dp_EVERYTHING%U.dmp
parallel=4
directory=IMP_DB
table_exists_action=append
tables=FLOWS_FILES.WWV_FLOW_FILE_OBJECTS$


$ cat images_impdp_WWV_FLOW_REPOSITORIES_TO_DIKPATER.par







DUMPFILE=dp_EVERYTHING%U.dmp
parallel=4
directory=IMP_DB
tables=APEX_040100.WWV_FLOW_CSS_REPOSITORY,APEX_040100.WWV_FLOW_IMAGE_REPOSITORY,APEX_040100.WWV_FLOW_HTML_REPOSITORY

remap_schema=(APEX_040100:DIKPATER)
remap_tablespace=(SYSAUX:USERS)

SQL> alter table flows_files."WWV_FLOW_FILE_OBJECTS$" disable all triggers ;
$ impdp parfile=images_impdp.par

SQL> alter table flows_files."WWV_FLOW_FILE_OBJECTS$" enable all triggers ;

Now we handle :

 apex_040100.WWV_FLOW_IMAGE_REPOSITORY
 apex_040100.WWV_FLOW_CSS_REPOSITORY
 apex_040100.WWV_FLOW_HTML_REPOSITORY

!!! create a user DIKPATER ( in my case) to hold the 3 REPOSITORY tables temporary.
!!! with tablespace quota ...and create table

$ impdp parfile=images_impdp_WWV_FLOW_REPOSITORIES_TO_DIKPATER.par

SQL> select * from all_objects where lower(object_name)like '%wwv_flow_%repository%'
and owner = 'APEX_040100' and object_type = 'TABLE'

SQL> select * from apex_040100.WWV_FLOW_CSS_REPOSITORY ;
SQL> alter table apex_040100.WWV_FLOW_CSS_REPOSITORY disable all triggers ;
SQL> insert into apex_040100.WWV_FLOW_CSS_REPOSITORY
select * from dikpater.WWV_FLOW_CSS_REPOSITORY ;
SQL> alter table apex_040100.WWV_FLOW_CSS_REPOSITORY
enable all triggers ;

SQL> select * from APEX_040100.WWV_FLOW_IMAGE_REPOSITORY ;
SQL> alter table apex_040100.WWV_FLOW_IMAGE_REPOSITORY disable all triggers ;
SQL> insert into apex_040100.WWV_FLOW_IMAGE_REPOSITORY
select * from dikpater.WWV_FLOW_IMAGE_REPOSITORY
where (flow_id, image_name, security_group_id) not in ( select flow_id, image_name, security_group_id from apex_040100.WWV_FLOW_IMAGE_REPOSITORY) ;
SQL> alter table apex_040100.WWV_FLOW_IMAGE_REPOSITORY
enable all triggers ;

SQL> alter table apex_040100.WWV_FLOW_HTML_REPOSITORY disable all triggers ;
SQL> insert into apex_040100.WWV_FLOW_HTML_REPOSITORY
select * from dikpater.WWV_FLOW_HTML_REPOSITORY ;
SQL> alter table apex_040100.WWV_FLOW_HTML_REPOSITORY
enable all triggers

Now the images are imported and ready to use.
I found many hits on the internet about missing images after import, they suggest just to import WWV_FLOW_FILE_OBJECTS$ alone, but in my opinion it is not enough.
I cannot find if this is a supported method, but maybe this can be helpfull.

Regards.

Dik Pater