X

Oracle Spatial and Graph – technical tips, best practices, and news from the product team

Graph Database Says Hello from the Cloud (Part III)

Alan Wu
Architect

In this installment, I am going to show you the steps required to create your first property graph on the Cloud.

- Login to the newly created database service. You can use Putty or SSH or  a tool of your choice.

- Create a tablespace as follows:

[oracle@graph122 dbhome_1]$ sqlplus / as sysdba

Oracle Database 12c EE Extreme Perf Release 12.2.0.1.0 - 64bit
Production

SQL> alter session set container=PDB1;

create bigfile tablespace pgts

datafile '?/dbs/pgts.dat' size 512M reuse autoextend on next
512M maxsize 10G

EXTENT MANAGEMENT LOCAL

segment space management
auto;

- Enable 32K Varchar2 which is
required by the Property Graph feature in Oracle Spatial and Graph option.
Detailed description of the following steps can be found in:

https://docs.oracle.com/database/121/REFRN/GUID-D424D23B-0933-425F-BC69-9C0E6724693C.htm#REFRN10321

SQL> conn
/ as sysdba

SQL>
ALTER SESSION SET CONTAINER=CDB$ROOT;

SQL>
ALTER SYSTEM SET max_string_size=extended SCOPE=SPFILE;

SQL>
shutdown immediate;

ORACLE instance
shut down.

SQL>
startup upgrade;

ORACLE
instance started.

Database
mounted.

SQL>
ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

Pluggable
database altered.

EXIT;

SQL>
Disconnected from Oracle Database 12c EE Extreme Perf Release 12.2.0.1…

[oracle@graph122
dbhome_1]$ cd $ORACLE_HOME/rdbms/admin

[oracle@graph122
admin]$ mkdir /u01/utl32k_cdb_pdbs_output

[oracle@graph122
admin]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS -d
$ORACLE_HOME/rdbms/admin -l '/u01/utl32k_cdb_pdbs_output' -b
utl32k_cdb_pdbs_output utl32k.sql

Enter
Password:

catcon.pl:
completed successfully

[oracle@graph122
admin]$ sqlplus / as sysdba

SQL>
shutdown immediate;

SQL>
startup

SQL>
ALTER PLUGGABLE DATABASE ALL OPEN READ WRITE;

Pluggable
database altered.

SQL> quit

Disconnected
from Oracle Database 12c EE Extreme Perf Release 12.2.0.1…

[oracle@graph122
admin]$ mkdir /u01/utlrp_cdb_pdbs_output

[oracle@graph122
admin]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -u SYS -d
$ORACLE_HOME/rdbms/admin -l '/u01/utlrp_cdb_pdbs_output' -b
utlrp_cdb_pdbs_output utlrp.sql

Enter
Password:

catcon.pl:
completed successfully

[oracle@graph122
admin]$

- Validate the change made to
MAX_STRING_SIZE
. To verify, run the following commands and you should see the
value of max_string_size changed to "EXTENDED"

[oracle@graph122 admin]$ sqlplus / as sysdba

SQL> alter session set container=PDB1;

Session altered.

SQL> show parameters max_string;

NAME TYPE VALUE

------------------------------------ -----------
------------------------------

max_string_size string EXTENDED

- Create a simple Property Graph and
add one vertex with a name "Property Graph", a second vertex with a
name "Oracle Database Cloud Service", and an edge with label
"livesIn" linking these two vertices. In addition, this edge has a
weight=1.0.

SQL> conn scott/<password>

SQL> exec opg_apis.create_pg('mypg', 4, 8, 'PGTS');

PL/SQL procedure successfully completed.

SQL> insert into mypgVT$(vid,k,t,v)
values(1,'name',1,'Property Graph');

SQL> insert into mypgVT$(vid,k,t,v) values(2,'name',1,'Oracle
Database Cloud Service');

SQL> insert into
mypgGE$(EID,SVID,DVID,EL,K,T,VN) values(100,1,2,'livesIn','weight',3,1.0);

SQL> commit;

Commit complete.

Cheers,

Zhe

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services