<?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: Kicking off users from cubes in Administration and Deployment</title>
    <link>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771233#M23134</link>
    <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301418"&gt;@barbe1lj&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You cab try the following macro&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**
*************************************************************************
* Lists and Closes All/Cube Specific Active Session on the specified OLAP
* Server.
* &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Usage Example:&amp;lt;br&amp;gt;
*	%olap_closeSessions(p_host=
*	,p_userid=
*	,p_password=
*	,p_port=5451
*	,p_cube=_ALL_);&amp;lt;br&amp;gt;
*
* @param	p_host		SAS OLAP Server Host Name network IP address
* @param	p_userid	Registered SAS Metadata User ID to use when
*						logging into the OLAP Server
* @param	p_password	Registered SAS Metadata Password. Please use
*						Encrypted password.
* @param	p_port		TCP/IP Port used by the SAS OLAP Server Process
*						Default:5451
* @param	p_cube		SAS OLAP Cube Name being used
*
*************************************************************************
*/

%MACRO olap_closeSessions(
	 p_host
	,p_userid=
	,p_password=
	,p_port=5451
	,p_cube=_ALL_
	);

	%local l_closeStmt;

	%let l_closeStmt=;

	/* Assign a Filename and redirect the SAS log to it */
	FILENAME outlog TEMP;

	PROC PRINTTO LOG=outlog NEW; RUN;

	/* Get a list of all Active Sessions on the OLAP Server */
	PROC OLAPOPERATE;
		CONNECT HOST="&amp;amp;p_host" PORT=&amp;amp;p_port USERID="&amp;amp;p_userid"
		PASSWORD="&amp;amp;p_password";

 		%if (%superq(p_cube) = _ALL_) %then
 		%do;
			LIST SESSIONS;
		%end;
		%else
		%do;
			  LIST SESSIONS CUBE="&amp;amp;p_cube";
		%end;
	RUN;

	/* Redirect the log back to the original log file */
	PROC PRINTTO LOG=log; RUN;

	/* Get Active Sessions on the OLAP Server */
	DATA WORK.SESSIONS (KEEP=ID);

		INFILE outlog TRUNCOVER;

		LENGTH text $256 ID $71;
		INPUT text $ &amp;amp;;

	    IF SUBSTR(text,1,10) = "Session ID" THEN
	    DO;
			ID = SCAN(text,3,' ');
			output;
		END;
	RUN;

	PROC SQL NOPRINT;
		SELECT	"CLOSE SESSION '"||STRIP(ID)||"';"
		INTO	:l_closeStmt separated by ' '
		FROM	WORK.SESSIONS ;
	QUIT;

	%put l_closeStmt=%superq(l_closeStmt);
	%put sqlobs=&amp;amp;sqlobs;

	/* Close All Active Sessions on the OLAP Server if there were any */
	%if (&amp;amp;SQLOBS GT 0) %then
	%do;
		PROC OLAPOPERATE;
			CONNECT HOST="&amp;amp;p_host" PORT=&amp;amp;p_port USERID="&amp;amp;p_userid"
			PASSWORD="&amp;amp;p_password";
			&amp;amp;l_closeStmt
		RUN;

		%PUT "NOTE: &amp;amp;SQLOBS SAS OLAP Server sessions were closed.";
	%end;

	PROC DATASETS LIB=work NOLIST; DELETE sessions; RUN; QUIT;
%MEND olap_closeSessions;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use the &lt;A href="mailto:sasadm@sapw" target="_blank"&gt;sasadm@saspw&lt;/A&gt;&amp;nbsp;user credentials to list and close all active sessions, or a specific session for a specific cube.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Sep 2021 20:12:13 GMT</pubDate>
    <dc:creator>AhmedAl_Attar</dc:creator>
    <dc:date>2021-09-29T20:12:13Z</dc:date>
    <item>
      <title>Kicking off users from cubes</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771211#M23129</link>
      <description>&lt;P&gt;We have a job that runs every morning at 7:00am. Sometimes we have users in reports that are using the cube that the job runs therefore the job fails.&lt;/P&gt;&lt;P&gt;Any suggestion on how to resolve this issue? Is there a script or rule that can be run to kill all sessions? I know how to do this manually but was wondering if anyone has every created a rule/script to do this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Lori&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 19:08:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771211#M23129</guid>
      <dc:creator>barbe1lj</dc:creator>
      <dc:date>2021-09-29T19:08:56Z</dc:date>
    </item>
    <item>
      <title>Re: Kicking off users from cubes</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771215#M23131</link>
      <description>Yes this can be done by utilizing the proc olapoperate - see the documentation: &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/olapug/n0rh9rcu3ucqzon1o9cb47zbzytj.htm" target="_blank"&gt;https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/olapug/n0rh9rcu3ucqzon1o9cb47zbzytj.htm&lt;/A&gt;</description>
      <pubDate>Wed, 29 Sep 2021 19:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771215#M23131</guid>
      <dc:creator>DavidHD</dc:creator>
      <dc:date>2021-09-29T19:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Kicking off users from cubes</title>
      <link>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771233#M23134</link>
      <description>&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/301418"&gt;@barbe1lj&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;You cab try the following macro&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**
*************************************************************************
* Lists and Closes All/Cube Specific Active Session on the specified OLAP
* Server.
* &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Usage Example:&amp;lt;br&amp;gt;
*	%olap_closeSessions(p_host=
*	,p_userid=
*	,p_password=
*	,p_port=5451
*	,p_cube=_ALL_);&amp;lt;br&amp;gt;
*
* @param	p_host		SAS OLAP Server Host Name network IP address
* @param	p_userid	Registered SAS Metadata User ID to use when
*						logging into the OLAP Server
* @param	p_password	Registered SAS Metadata Password. Please use
*						Encrypted password.
* @param	p_port		TCP/IP Port used by the SAS OLAP Server Process
*						Default:5451
* @param	p_cube		SAS OLAP Cube Name being used
*
*************************************************************************
*/

%MACRO olap_closeSessions(
	 p_host
	,p_userid=
	,p_password=
	,p_port=5451
	,p_cube=_ALL_
	);

	%local l_closeStmt;

	%let l_closeStmt=;

	/* Assign a Filename and redirect the SAS log to it */
	FILENAME outlog TEMP;

	PROC PRINTTO LOG=outlog NEW; RUN;

	/* Get a list of all Active Sessions on the OLAP Server */
	PROC OLAPOPERATE;
		CONNECT HOST="&amp;amp;p_host" PORT=&amp;amp;p_port USERID="&amp;amp;p_userid"
		PASSWORD="&amp;amp;p_password";

 		%if (%superq(p_cube) = _ALL_) %then
 		%do;
			LIST SESSIONS;
		%end;
		%else
		%do;
			  LIST SESSIONS CUBE="&amp;amp;p_cube";
		%end;
	RUN;

	/* Redirect the log back to the original log file */
	PROC PRINTTO LOG=log; RUN;

	/* Get Active Sessions on the OLAP Server */
	DATA WORK.SESSIONS (KEEP=ID);

		INFILE outlog TRUNCOVER;

		LENGTH text $256 ID $71;
		INPUT text $ &amp;amp;;

	    IF SUBSTR(text,1,10) = "Session ID" THEN
	    DO;
			ID = SCAN(text,3,' ');
			output;
		END;
	RUN;

	PROC SQL NOPRINT;
		SELECT	"CLOSE SESSION '"||STRIP(ID)||"';"
		INTO	:l_closeStmt separated by ' '
		FROM	WORK.SESSIONS ;
	QUIT;

	%put l_closeStmt=%superq(l_closeStmt);
	%put sqlobs=&amp;amp;sqlobs;

	/* Close All Active Sessions on the OLAP Server if there were any */
	%if (&amp;amp;SQLOBS GT 0) %then
	%do;
		PROC OLAPOPERATE;
			CONNECT HOST="&amp;amp;p_host" PORT=&amp;amp;p_port USERID="&amp;amp;p_userid"
			PASSWORD="&amp;amp;p_password";
			&amp;amp;l_closeStmt
		RUN;

		%PUT "NOTE: &amp;amp;SQLOBS SAS OLAP Server sessions were closed.";
	%end;

	PROC DATASETS LIB=work NOLIST; DELETE sessions; RUN; QUIT;
%MEND olap_closeSessions;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can use the &lt;A href="mailto:sasadm@sapw" target="_blank"&gt;sasadm@saspw&lt;/A&gt;&amp;nbsp;user credentials to list and close all active sessions, or a specific session for a specific cube.&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;Ahmed&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Sep 2021 20:12:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Administration-and-Deployment/Kicking-off-users-from-cubes/m-p/771233#M23134</guid>
      <dc:creator>AhmedAl_Attar</dc:creator>
      <dc:date>2021-09-29T20:12:13Z</dc:date>
    </item>
  </channel>
</rss>

