{
  "date": "2017-02-01T13:06:33",
  "slug": "running-slob-on-exadata-express-cloud-service",
  "link": "https://www.dbi-services.com/blog/running-slob-on-exadata-express-cloud-service/",
  "title": {
    "rendered": "Running SLOB on Exadata Express Cloud Service"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nThe Exadata Express Cloud Service is a managed PDBaaS: Oracle is the system admin and the CDB database administrator, you are the PDB administrator. You connect with a local user, PDB_ADMIN, which is no SYSDBA privilege but has a PDB_DBA which has nearly all DBA rights, but with some features disabled by lockdown profile.<br />\nI have no worry about the performance on this service: it is an Exadata X5 half rack bare metal (my guess), the CDB running as RAC One Node on 2 compute nodes, accessing the 7 storage cells. Smart Scan is disabled and given the small size of the PDB, and the low usage of the CDB, I/O is fast (most single block latency bwtween 128 and 256us coming from cell flash cache).<br />\nBut I like to run SLOB on new platforms and I wanted to see if I can run it here, without SYSDBA role, and connecting to a CDB.<br />\nYou can find SLOB at <a href=\"https://kevinclosson.net/slob/\" target=\"_blank\" rel=\"noopener noreferrer\">https://kevinclosson.net/slob/</a><br />\n<!--more--></p>\n<h3>TNS_ADMIN</h3>\n<p>I&#8217;ll connect remotely because SLOB will be running on my computer (I have no access to the host for the PDBaaS managed service). In order to connect remotely, through a SQL*Net over SSL, you have to download the client credentials kit<br />\n<a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureEXCS017.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureEXCS017.png\" alt=\"CaptureEXCS017\" width=\"952\" height=\"219\" class=\"alignnone size-full wp-image-14557\" /></a></p>\n<p>It is a zip file that contains the encryption wallet and the sqlnet.ora and tnsnames.ora to use. I unzip it in a directory (/var/tmp/client_credentials in this example) and I&#8217;ll use it by setting the TNS_ADMIN environment to this directory.<br />\nThus I change the wallet location in the sqlnet.ora:<br />\n$ cat sqlnet.ora</p>\n<pre><code>WALLET_LOCATION = (SOURCE = (METHOD = file)\n                   (METHOD_DATA = (DIRECTORY=\"$TNS_ADMIN\")))\n</code></pre>\n<p>and I use the provided tnsnames.ora which defines the &#8216;dbaccess&#8217; service:</p>\n<pre><code>$ cat tnsnames.ora\ndbaccess = (description=\n          (address=(protocol=tcps)(port=1522)(host=dbaccess.us2.oraclecloudapps.com))\n          (connect_data=(service_name=eptdojjm1ag.usdc2.oraclecloud.com))\n          (security=(ssl_server_cert_dn=\"CN=dbaccess.us2.oraclecloudapps.com,O=Oracle Corporation,L=Redwood Shores,ST=California,C=US\"))\n       )</code></pre>\n<h3>Changes in slob.conf</h3>\n<p>The default slob.conf connects with a bequeath connection. Here I need to connect through the network service described above. I uncommented:</p>\n<pre><code>\n#ADMIN_SQLNET_SERVICE=slob\n#SQLNET_SERVICE_BASE=slob\n#SYSDBA_PASSWD=change_on_install\n</code></pre>\n<p>and replaced it with:</p>\n<pre><code>\nADMIN_SQLNET_SERVICE=dbaccess\nSQLNET_SERVICE_BASE=dbaccess\nSYSDBA_PASSWD=xxxxxxxxx\n</code></pre>\n<p>Where xxxxxxxxx is my PDB_ADMIN password that I setup in:<br />\n<a href=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureEXCS0241.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https://www.dbi-services.com/blog/wp-content/uploads/sites/2/2022/04/CaptureEXCS0241.png\" alt=\"CaptureEXCS024\" width=\"300\" height=\"204\" class=\"alignnone size-medium wp-image-14555\" /></a></p>\n<p>Of course we need an Oracle Client. Download instant client if you don&#8217;t have one.</p>\n<h3>Changes in setup.sh</h3>\n<p>SLOB creates the users and grant them RESOURCE,DBA<br />\nIn Exadata Express Cloud Service, I don&#8217;t have the DBA role but the CREATE SESSION, and the PDB_ROLE which is sufficient. In addition to that I need to give quota to the IOPS tablespace because PDB_ADMIN do not have unlimited tablespace. Finally here is the create user part after my modifications:</p>\n<pre><code>\nmsg NOTIFY \"Creating user: $user \"\n&nbsp;\nsqlplus \"$constring\" &lt;&lt;EOF\nWHENEVER SQLERROR EXIT 2;\nSET TERMOUT ON\nSET ECHO ON\nPROMPT User grants for $user\nWHENEVER SQLERROR EXIT 2;\nGRANT CREATE SESSION TO $user IDENTIFIED BY $user;\nGRANT PDB_DBA TO $user;\nALTER USER $user DEFAULT TABLESPACE $tablespace ;\nALTER USER $user QUOTA UNLIMITED ON $tablespace ;\nEXIT;\nEOF\n</code></pre>\n<p>The setup.sh starts by dropping the SLOB schemas up to MAX_SLOB_SCHEMAS just in case they are there. The default is 4096 but that&#8217;s too much for me because of the latency to the server in US (it is planned to have Exadata Express Cloud Service in Europe in the future), so I reduced it to 8 (as I have only 1 CPU in this service, there&#8217;s no need for more users):</p>\n<pre><code>\nexport MAX_SLOB_SCHEMAS=8\n</code></pre>\n<p>And last modification in setup.sh was to disable the Multitenant checking because PDBaaS is by definition on a Multitenant database:</p>\n<pre><code>\nif ( ! check_mto \"$ADMIN_CONNECT_STRING\")\nthen\n        msg FATAL \"\"\n        msg FATAL \"This version of SLOB does not support Oracle Multitenant Option\"\n        msg FATAL\n        #exit 1\nfi\n</code></pre>\n<p>I&#8217;ve not seen any problem. Oracle designed multitenant so that everything you used to do on a database is possible to do on a PDB.</p>\n<h3>Changes in runit.sh</h3>\n<p>First, in order to connect as PDB_ADMIN instead of SYS as SYSDBA, you have to change the admin_connect_string:</p>\n<pre><code>\n        export admin_connect_string=\"pdb_admin/${SYSDBA_PASSWD}@${ADMIN_SQLNET_SERVICE}\"\n</code></pre>\n<p>Second, SLOB calls UTL_FILE which is not allowed in Exadata Express Cloud Service. Becase I&#8217;ve seen in the code that this is bypassed when the &#8216;nt&#8217; argument is 1 so I&#8217;ve set it to this value in runit.sh:</p>\n<pre><code>\n        arg9=1 #was: $nt\n</code></pre>\n<p>Finally, because we can&#8217;t create manual AWR snapshots in Exadata Express Cloud Service, I replaced the EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT by the creation of a small view to get the basic statistics:</p>\n<pre><code>\ncreate or replace view FPAV as\nselect 'STAT' class,name,value from V$SYSSTAT\nunion all\nselect 'WAIT' class,event,total_waits from V$SYSTEM_EVENT\nunion all\nselect 'TIME' class,stat_name,value from V$SYS_TIME_MODEL\nunion all\nselect 'V$OS' class,stat_name,value from V$OSSTAT\nunion all\nselect 'MICRO' class,event||' - '||wait_time_format,wait_count from V$EVENT_HISTOGRAM_MICRO\n;\ncreate table FPAT as select sysdate time,FPAV.* from FPAV where 1=0;\ninsert into FPAT select sysdate time,FPAV.* from FPAV;\ncommit;\n</code></pre>\n<p>and I replaced the part that runs the AWR report with a simple query:</p>\n<pre><code>\n($admin_conn &lt;&lt;EOF\nset echo on heading on underline on linesize 120 trimspool on pagesize 1000;\nhost cat slob.conf &gt; awr.txt\nspool awr.txt append\ncommit;\ncolumn per_sec format 999G999G999G999G999\nselect to_char(btim,'hh24:mi:ss') btime,to_char(time,'hh24:mi:ss')etime,seconds,class,name,round(delta/seconds) per_second , decode(class||' '||name\n ,'STAT session logical reads','LIO/s'\n ,'STAT physical read total IO requests','PIO/s'\n ,'TIME DB CPU','CPU us'\n ,'TIME DB time','DB time us'\n ,'STAT physical read total bytes','Read B/s'\n ,'STAT physical write total bytes','Write B/s'\n ,'V$OS BUSY_TIME','OS busy cs'\n ,'WAIT resmgr:cpu quantum','resmgr'\n) main from (\n select\n FPAT.*\n ,max(time)over(order by time rows between unbounded preceding and unbounded following) last\n ,value-lag(value)over(partition by class,name order by time) delta\n ,(time-lag(time)over(partition by class,name order by time))*24*60*60 seconds\n ,lag(time)over(partition by class,name order by time) btim\n from FPAT\n) where time=last and delta&gt;0 order by main,per_second desc;\nspool off\nhost cp awr.txt awr$(date +%Y%m%d%H%M%S).txt\nexit\nEOF\n) &amp;\n</code></pre>\n<p>Statspack is not an alternative here because it requires some views and grants from SYS which you cannot do on Exadata Express Cloud Service. I really don&#8217;t understand why we cannot use AWR locally because in 12.2 you can have AWR snapshots at PDB level. But any use of dbms_workload_repository is disabled by lockdown profile.</p>\n<h3>Result</h3>\n<p>So this is the kind of output I get on running 2 SLOB sessions during 10 minutes:</p>\n<pre><code>\nBTIME    ETIME       SECONDS CLAS NAME                                                             PER_SECOND MAIN\n-------- -------- ---------- ---- ---------------------------------------------------------------- ---------- ----------\n11:16:09 11:26:15        606 TIME DB CPU                                                              1968151 CPU us\n11:16:09 11:26:15        606 TIME DB time                                                             1981479 DB time us\n11:16:09 11:26:15        606 STAT session logical reads                                               1228557 LIO/s\n11:16:09 11:26:15        606 STAT physical read total IO requests                                           0 PIO/s\n11:16:09 11:26:15        606 STAT physical read total bytes                                               189 Read B/s\n11:16:09 11:26:15        606 STAT physical write total bytes                                              189 Write B/s\n11:16:09 11:26:15        606 WAIT resmgr:cpu quantum                                                        0 resmgr\n11:16:09 11:26:15        606 STAT logical read bytes from cache                                    1.0064E+10\n11:16:09 11:26:15        606 TIME sql execute elapsed time                                            1980376\n11:16:09 11:26:15        606 V$OS IDLE_TIME                                                              6787\n11:16:09 11:26:15        606 V$OS BUSY_TIME                                                               391\n11:16:09 11:26:15        606 V$OS USER_TIME                                                               311\n</code></pre>\n<p>1.96 CPU seconds per second and 1.98 DB time. Those are my 2 cached SLOB sessions.<br />\nAbout 1.2 million LIO per seconds. This is what I expect from those test on Exadata X5 (PCT_UPDATE=0 and WORK_UNIT=64).<br />\nResource manager ready to kick in as my CPU_COUNT is set to 2 in my PDB (set by lockdown profile, you cannot change it)<br />\nThe overall system hosting the CDB has been mostly idle: 3.91 / (67.87 + 3.91) is 5.44% busy. I&#8217;m responsible for 2 sessions over 72 threads (36 cores): 2/72=2.78% CPU usage</p>\n<p>The Exadata Express Cloud Service allocates 1 core (2 threads) but because the system is nearly idle, I didn&#8217;t use 2 threads of the same core. Let&#8217;s compare with a 1 session only run:</p>\n<pre><code>\nBTIME    ETIME       SECONDS CLAS NAME                                                             PER_SECOND MAIN\n-------- -------- ---------- ---- ---------------------------------------------------------------- ---------- ----------\n12:15:49 12:25:55        606 TIME DB CPU                                                               989008 CPU us\n12:15:49 12:25:55        606 TIME DB time                                                              991198 DB time us\n12:15:49 12:25:55        606 STAT session logical reads                                                668368 LIO/s\n12:15:49 12:25:55        606 STAT physical read total IO requests                                           0 PIO/s\n12:15:49 12:25:55        606 STAT physical read total bytes                                               203 Read B/s\n12:15:49 12:25:55        606 STAT physical write total bytes                                              189 Write B/s\n12:15:49 12:25:55        606 STAT logical read bytes from cache                                    5475272359\n12:15:49 12:25:55        606 TIME sql execute elapsed time                                             990290\n12:15:49 12:25:55        606 STAT consistent gets                                                      668368\n</code></pre>\n<p>Comparing logical reads, 1228557/668368=1.8 so probably I was not running the two sessions on the same core.</p>\n<h3>So what?</h3>\n<p>SLOB (<a href=\"https://kevinclosson.net/slob/\">https://kevinclosson.net/slob/</a>) doesn&#8217;t need to be installed on the database server because it is mostly PL/SQL, so no roundtrips. And this is a way to run it when you have only access to a PDB without SYSDBA privileges.</p>\n",
    "protected": false
  }
}
