By default, no sample database TPCC exists in OceanBase. You need to create one manually. The sample database must be created in a business tenant. For more information about the sample database, see About sample database TPCC.
After the tenant is created, you need to create a database to store the sample database objects and grant access permissions to users.
Example
- Connect to an Oracle tenant through OBClient. For more information, see Connect to an OceanBase tenant through OBClient.
$obclient -h10.0.0.0 -usys@t_oracle0_91#obdoc -P2883 -p**1*** sys
obclient: [Warning] Using a password on the command line interface can be insecure.
Welcome to the OceanBase monitor. Commands end with ; or \g.
Your OceanBase connection id is 58725
Server version: 5.6.25 OceanBase 2.2.20 (...) (Built Aug 10 2019 15:27:33)
<...Omitted...>
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient>
- Create a schema, which is the user.
obclient> create user tpcc identified by **1***;
Query OK, 0 rows affected (0.02 sec)
obclient> grant all privileges on tpcc.* to tpcc;
Query OK, 0 rows affected (0.02 sec)
obclient> grant create,drop,select on *.* to tpcc;
Query OK, 0 rows affected (0.01 sec)
obclient> grant select on sys.* to tpcc;
Query OK, 0 rows affected (0.02 sec)
obclient> show grants for tpcc;
+---------------------------------------------+
| Grants for TPCC@% |
+---------------------------------------------+
| GRANT CREATE, DROP, SELECT ON *.* TO 'TPCC' |
| GRANT SELECT ON "SYS".* TO 'TPCC' |
| GRANT ALL PRIVILEGES ON "TPCC".* TO 'TPCC' |
+---------------------------------------------+
3 rows in set (0.00 sec)
- Log on to the TPCC mode as the tpcc user.
$obclient -h10.0.0.0 -utpcc@t_oracle0_91#obdoc -P2883 -p**1*** tpcc
- Create database objects
obclient> source create_tables_oracle.sql
Query OK, 0 rows affected (0.21 sec)
<...Omitted...>
Query OK, 0 rows affected (0.07 sec)
+-----------+------------+-------------+-----------+
| SYSDATE | TABLE_NAME | PARTITIONED | TEMPORARY |
+-----------+------------+-------------+-----------+
| 01-APR-20 | CUST | YES | N |
| 01-APR-20 | DIST | YES | N |
| 01-APR-20 | HIST | YES | N |
| 01-APR-20 | ITEM | NO | N |
| 01-APR-20 | LOAD_HIST | NO | N |
| 01-APR-20 | LOAD_PROC | NO | N |
| 01-APR-20 | NORD | YES | N |
| 01-APR-20 | ORDL | YES | N |
| 01-APR-20 | ORDR | YES | N |
| 01-APR-20 | STOK | YES | N |
| 01-APR-20 | WARE | YES | N |
+-----------+------------+-------------+-----------+
11 rows in set (0.02 sec)
- Initialize the table data.
obclient> source init_data.sql
Query OK, 0 rows affected (0.01 sec)
<...Omitted...>
Query OK, 0 rows affected (0.01 sec)
Query OK, 1 row affected (0.00 sec)
Query OK, 0 rows affected (0.03 sec)
+------------+----------+
| TABLE_NAME | ROWS_CNT |
+------------+----------+
| WARE | 2 |
| DIST | 20 |
| NORD | 40 |
| ORDR | 60 |
| HIST | 240 |
| ITEM | 622 |
| ORDL | 626 |
| CUST | 1040 |
| STOK | 1244 |
+------------+----------+
9 rows in set (0.03 sec)