{"id":1851,"date":"2019-04-16T00:39:54","date_gmt":"2019-04-15T22:39:54","guid":{"rendered":"http:\/\/www.ludovicocaldara.net\/dba\/?p=1851"},"modified":"2020-08-18T16:03:13","modified_gmt":"2020-08-18T14:03:13","slug":"coe","status":"publish","type":"post","link":"https:\/\/www.ludovicocaldara.net\/dba\/coe\/","title":{"rendered":"First draft of a Common Oracle Environment&#8230; for the Cloud Database (and not only)"},"content":{"rendered":"<p>I have just <a href=\"https:\/\/github.com\/ludovicocaldara\/COE\">published on GitHub<\/a> a draft of a common Oracle environment scripts that make the shell environment a little bit smarter than what it is by default. It uses some function and aliases that I have published during the past years.<\/p>\n<p>You can start playing with:<\/p>\n<pre class=\"lang:sh decode:true\"># Connect as oracle\r\nsudo su - oracle\r\n\r\n# Clone this repository\r\ngit clone https:\/\/github.com\/ludovicocaldara\/COE.git\r\n\r\n# Enable the profile scripts\r\necho \". ~\/COE\/profile.sh\" &gt;&gt; $HOME\/.bash_profile\r\n\r\n# Load the new profile\r\n. ~\/.bash_profile<\/pre>\n<p><strong>Ideal for the Oracle Cloud Infrastructure<\/strong><\/p>\n<p>If you are new to the Oracle Cloud, probably you do not have environment scripts that makes it easy to interact with the database.<\/p>\n<p>The environment scripts that I have published work out-of the box in the cloud (just make sure that you have rlwrap installed so that you can have a better CLI experience).<\/p>\n<p>Actually, they work great as well on-premises, but I assume that you already have something automatic there.<\/p>\n<p><strong>Some examples<\/strong><\/p>\n<ul>\n<li>My famous Smart Prompt \ud83d\ude09 (including version, edition, exit code, etc)<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\"># [ oracle@ludodb01:\/home\/oracle [22:18:59] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n#<\/pre>\n<ul>\n<li><strong>u<\/strong> : gets the status of the databases<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true \"># [ oracle@ludodb01:\/home\/oracle [22:18:59] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# u\r\nDB_Unique_Name           DB_Name  ludodb01       Oracle_Home\r\n------------------------ -------- -------------- --------------------------------------------------\r\nCDB_fra1cw               CDB      CDB            \/u01\/app\/oracle\/product\/18.0.0.0\/dbhome_1\r\n<\/pre>\n<ul>\n<li><strong>pmon<\/strong>: just displays the running pmon processes<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\"># [ oracle@ludodb01:\/home\/oracle [22:27:17] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# pmon\r\ngrid      8093     1  0 Mar25 ?        00:01:39 asm_pmon_+ASM1\r\ngrid     10293     1  0 Mar25 ?        00:01:43 apx_pmon_+APX1\r\noracle   11077     1  0 Mar25 ?        00:01:47 ora_pmon_CDB\r\n<\/pre>\n<ul>\n<li><strong>db :\u00a0<\/strong>sets the environment for a specific DB_NAME, DB_UNIQUE_NAME or SID<\/li>\n<\/ul>\n<pre class=\"lang:plsql decode:true \"># [ oracle@ludodb01:\/u01\/app\/oracle\/diag\/rdbms\/cdb_fra1cw\/CDB\/trace [22:33:53] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# db CDB\r\nDB_UNIQUE_NAME  = CDB_fra1cw\r\nORACLE_SID      = CDB\r\nROLE            = PRIMARY\r\nVERSION         = 18.4.0.0.0\r\nORACLE_HOME     = \/u01\/app\/oracle\/product\/18.0.0.0\/dbhome_1\r\nNLS_LANG        = AMERICAN_AMERICA.AL32UTF8\r\n<\/pre>\n<ul>\n<li><strong>svcstat<\/strong> : shows the running services (and the corresponding pdb, host, etc) as I described in my previous post<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true \"># [ oracle@ludodb01:\/home\/oracle [22:28:03] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# svcstat\r\nDB_Unique_Name           Service_Name                   PDB                            ludodb01\r\n------------------------ ------------------------------ ------------------------------ --------------\r\ncdb_fra1cw               pdb_service_test               PDB1                           ONLINE\r\n<\/pre>\n<ul>\n<li><strong>s_\u00a0<\/strong>: smart alias for sqlplus: connects as sysdba\/sysasm by default, or with any arguments that you pass:<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true \"># [ oracle@ludodb01:\/home\/oracle [22:29:14] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# s_\r\n\r\nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Apr 15 22:30:22 2019\r\nVersion 18.4.0.0.0\r\n\r\nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\r\n\r\n\r\nConnected to:\r\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\r\nVersion 18.4.0.0.0\r\n\r\nSQL&gt; show user\r\nUSER is \"SYS\"\r\nSQL&gt; Disconnected from Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\r\nVersion 18.4.0.0.0\r\n\r\n# [ oracle@ludodb01:\/home\/oracle [22:30:30] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# s_ pippo\/pippo\r\n\r\nSQL*Plus: Release 18.0.0.0.0 - Production on Mon Apr 15 22:30:34 2019\r\nVersion 18.4.0.0.0\r\n\r\nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\r\n\r\nERROR:\r\nORA-01017: invalid username\/password; logon denied\r\n\r\n\r\nEnter user-name:\r\n<\/pre>\n<ul>\n<li><strong>adr_, dg_ rman_, cm_, lsn_ :\u00a0<\/strong>aliases for common oracle binaries<\/li>\n<li><strong>genpasswd :\u00a0<\/strong>generates random passwords (default length 30)<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true \"># [ oracle@ludodb01:\/home\/oracle [22:32:35] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# genpasswd\r\n+gagDCqVSgqHqsU+-IdeA0nx_-HVZ1\r\n\r\n# [ oracle@ludodb01:\/home\/oracle [22:33:00] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# genpasswd 12\r\nDiU9nHiwPB9y\r\n<\/pre>\n<ul>\n<li><strong>lsoh<\/strong>: lists the Oracle Homes attached to the inventory<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true\"># [ oracle@ludodb01:\/u01\/app\/oracle\/diag\/rdbms\/cdb_fra1cw\/CDB\/trace [22:33:53] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# lsoh\r\n\r\nHOME                        LOCATION                                                VERSION      EDITION\r\n--------------------------- ------------------------------------------------------- ------------ ---------\r\nOraGrid180                  \/u01\/app\/18.0.0.0\/grid                                  18.4.0.0.0   GRID\r\nOraDB18000_home1            \/u01\/app\/oracle\/product\/18.0.0.0\/dbhome_1               18.4.0.0.0   DBMS EE\r\n<\/pre>\n<ul>\n<li><strong>setoh<\/strong>: sets the Oracle Home given its name in the inventory<\/li>\n<\/ul>\n<pre class=\"lang:sh decode:true \"># [ oracle@ludodb01:\/u01\/app\/oracle\/diag\/rdbms\/cdb_fra1cw\/CDB\/trace [22:35:38] [18.4.0.0.0 [DBMS EE] SID=CDB] 0 ] #\r\n# setoh OraGrid180\r\nVERSION         = 18.4.0.0.0\r\nORACLE_HOME     = \/u01\/app\/18.0.0.0\/grid\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>You might want to install the same environment for <strong>oracle<\/strong>, <strong>grid<\/strong> (if you have role separation, it should be the case for Cloud DB Systems) and (eventually) <strong>root<\/strong>.<\/p>\n<p>I am curious to know if it works well for your environment.<\/p>\n<p>Cheers<\/p>\n<p>&#8212;<\/p>\n<p>Ludo<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have just published on GitHub a draft of a common Oracle environment scripts that make the shell environment a little bit smarter than what it is by default. It uses some function and aliases that I have published during &hellip; <a href=\"https:\/\/www.ludovicocaldara.net\/dba\/coe\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[321,326,309,308,330],"tags":[],"class_list":["post-1851","post","type-post","status-publish","format-standard","hentry","category-aced","category-oracle","category-oracle-cloud","category-oracle-database-18c","category-oracle-inst-upg"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/comments?post=1851"}],"version-history":[{"count":4,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1851\/revisions"}],"predecessor-version":[{"id":1856,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1851\/revisions\/1856"}],"wp:attachment":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/media?parent=1851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/categories?post=1851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/tags?post=1851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}