Troubleshooting Tips
Use these tips to discover information about the Globally Distributed Database that you need to help you troubleshoot issues.
Pre-Deployment Network Validation
Several GDSCTL commands have a -validate_network
option to
detect network configuration issues as early as possible during the specification and
deployment of distributed databases.
The -validate_network
can be used in following GDSCTL
commands for distributed databases:
-
add {invitednode | invitedsubnet}
-
add shard
-
deploy
-
start gsm
-
validate
(also includes-show_errors
)
Checking the Data Distribution Method
Run gdsctl config sdb
to check which data distribution
(sharding) method is used in the distributed database.
The data distribution method can be system-managed, composite, user-defined, directiry-based, or federated.
The distribution method is shown under "Shard type" in the output of
gdsctl config sdb
as shown here.
gdsctl> config sdb
GDS Pool administrators
------------------------
Replication Type
------------------------
Data Guard
Shard type
------------------------
System-managed
Shard spaces
------------------------
shd1
Services
------------------------
srv1
Checking the Replication Type
Run gdsctl config sdb
to check which method is used for
shard replication in the distributed database.
The replication type is shown under "Replication Type" in the output of
gdsctl config sdb
as shown here.
gdsctl> config sdb
GDS Pool administrators
------------------------
Replication Type
------------------------
Data Guard
Shard type
------------------------
System-managed
Shard spaces
------------------------
shd1
Services
------------------------
srv1
Table 19-1 Replication types in config sdb output
Replication Type | Value Shown in Output |
---|---|
Oracle Data Guard | Data Guard |
Raft |
Checking the Oracle Data Guard Protection Mode
You can run gdsctl config shardspace
on a given shardspace
to check the Oracle Data Guard protection mode in your GDSCTL session, rather than
switching to DGMGRL.
Data Guard can be configured in three different protection modes: MaxProtection, MaxAvailability, and MaxPerformance.
The Data Guard protection mode is shown under PROTECTION MODE in the
gdsctl config shardspace
command output, as
shown here.
GDSCTL> config shardspace -shardspace shd1
Shard Group Region Role
----------- ------ ----
dbs1 east Primary
PROTECTION_MODE Chunks
--------------- ------
MaxProtection 6
Checking Which Shards Are Mapped to a Key
You can run gdsctl config
chunks -key
to check which shards are mapped to a sharding
key.
Example 1: Single Table Family
In the following example, there is only one table family in the distributed database configuration, and the table is partitioned (sharded) on data type number.
In this example, the user is checking which chunk sharding key value "2" is mapped to. In the output it shows sharding key 2 is mapped to chunk "3" and is present in the database "aime1b".
GDSCTL> config chunks -key 2
Range Definition
------------------------
Chunks Range Definition
------ ----------------
3 1431655764-2147483646
Databases
------------------------
aime1b
Similarly, this can be done for any data type sharding is done on. Also, a multiple column sharding key can be checked with comma separated values.
The range definition is the range of hash values and can be ignored.
Example 2: Multiple Table Families
In a multiple table family configuration, add the option
-table_family
to specify the table family
to which the specified sharding key belongs.
The config chunks
command lists shards from all
shardgroups in the topology. This example also lists a Data Guard
standby shardgroup, as shown by the addition of "aime1e" to the
Databases (shards) list.
GDSCTL> config chunks -key 1 -table_family testuserfam3.customersfam1
Range Definition
------------------------
Chunks Range Definition
------ ----------------
1 0-357913941
Databases
------------------------
aime1b
aime1e
Example 3: Specifying a Multiple Column Sharding Key
When a table is sharded by multiple columns, specify the sharding key value as a comma-separated list as shown here.
GDSCTL> config chunks -key 10,mary,2010-04-04
Range Definition
------------------------
Chunks Range Definition
------ ----------------
4 1288490187-1717986916
Databases
------------------------
aime1b
aime1e
Checking Shard Operation Mode (Read-Only or Read-Write)
You can check whether shards are running in read-only or read-write mode by
running gdsctl config chunks -cross_shard
.
The gdsctl config chunks -cross_shard
command output
shows which shards, listed under "Database", are running in
read-only and read-write modes, as shown below. The command also
lists the chunk ranges on those shards.
gdsctl config chunks -cross_shard
Read-Only cross shard targets
------------------------
Database From To
-------- ---- --
tst3b_cdb2_pdb1 1 3
tst3c_cdb3_pdb1 9 10
tst3d_cdb2_pdb1 4 5
tst3e_cdb3_pdb1 6 8
Chunks not offered for cross-shard
------------------------
Shard space From To
----------- ---- --
Read-Write cross-shard targets
------------------------
Database From To
-------- ---- --
tst3b_cdb2_pdb1 1 5
tst3c_cdb3_pdb1 6 10
Chunks not offered for Read-Write cross-shard activity
------------------------
Data N/A
Checking DDL Text
Run gdsctl show ddl -ddl ddl_id
to get the
text for the specified DDL.
The DDL numeric identifier is specified with -ddl
ddl_id
to get the text
and other details of a particular DDL, as shown here.
gdsctl show ddl -ddl 5
DDL Text: CREATE SHARDED TABLE Customers ( CustNo NUMBER NOT NULL, Name VARCHAR2(50), Address VARCHAR2(250), Location VARCHAR2(20), Class VARCHAR2(3), CONSTRAINT RootPK PRIMARY KEY(CustNo)) PARTITION BY CONSISTENT HASH (CustNo) PARTITIONS AUTO TABLESPACE SET ts1
Owner: TESTUSER1
Object name: CUSTOMERS
DDL type: C
Obsolete: 0
Failed shards:
Note:
Theshow
ddl
command output might be truncated. You can run
SELECT ddl_text FROM
gsmadmin_internal.ddl_requests
on the shard catalog
to see the full text of the statements.
Checking Chunk Migration Status
Run gdsctl config chunks -show_reshard
to check the
status of chunk migration.
A chunk move is a long running operation, whether user-initiated or
internal (during incremental deploy), so if you need to check the
status, the gdsctl config chunks -show_reshard
provides the following status indicators as the move progresses.
-
empty - indicates no chunk migration in progress
-
scheduled - chunk is pending movement, which could be because it is waiting on another chunk move to complete, or the move didn't initiate due to some error
-
running - current in progress
-
failed - chunk move failed. Check GSM traces and source and target database traces for details.
In the following example, chunk move status is shown in the "Ongoing chunk movement" table in the command output.
gdsctl config chunks -show_reshard
Chunks
------------------------
Database From To
-------- ---- --
tst3b_cdb2_pdb1 1 6
tst3c_cdb3_pdb1 7 10
tst3d_cdb2_pdb1 1 6
tst3e_cdb3_pdb1 7 10
Ongoing chunk movement
------------------------
Chunk Source Target status
----- ------ ------ ------
7 tst3c_cdb3_pdb1 tst3b_cdb2_pdb1 Running
8 tst3c_cdb3_pdb1 tst3b_cdb2_pdb1 scheduled
9 tst3c_cdb3_pdb1 tst3b_cdb2_pdb1 scheduled
10 tst3c_cdb3_pdb1 tst3b_cdb2_pdb1 scheduled
Checking Table Type (Sharded or Duplicated)
You can check whether tables are sharded or duplicated in
dba/all/user_tables using SELECT TABLE_NAME,SHARDED,DUPLICATED FROM
user_tables;
.
In the following example, column "S" indicates whether a table is sharded, and column "D" indicates whether a table is duplicated.
SQL> select TABLE_NAME,SHARDED,DUPLICATED from user_tables;
TABLE_NAME S D
--------------- - -
CUSTOMERS Y N
DUP1 N Y
LINEITEMS Y N
MLOG$_DUP1 N N
ORDERS Y N
Checking User Type (Local or ALL_SHARD)
You can find out which users are created as local users and which
are distributed database users by selecting the username and ALL_SHARD
column in
dba/all/user_users.
SQL> select USERNAME,ALL_SHARD from users_users where username='TESTUSER1';
USERNAME ALL_SHARD
--------------- ---------
TESTUSER1 YES
Identifying Tables Created as Sharded Tablespaces
You can find out whether tablespaces are used for a sharded table by selecting the TABLESPACE_NAME and CHUNK_TABLESPACE columns in dba/all/user_tablespaces.
The value in the CHUNK_TABLESPACE column is Y in dba/all/user_tablespaces if it is a tablespace for a sharded table.
SQL> select TABLESPACE_NAME,CHUNK_TABLESPACE from user_tablespaces;
TABLESPACE_NAME C
------------------------------ -
SYSTEM N
SYSAUX N
TEMP N
SYSEXT N
TS1 Y
Checking if Shard DDL is Enabled or Disabled
You can check if Shard DDL is enabled or disabled in the current SQL session.
These examples show the result of checking Shard DDL status after enabling and disabling Shard DDL.
SQL> alter session enable shard ddl;
Session altered.
SQL> select shard_ddl_status from v$session where AUDSID = userenv('SESSIONID');
SHARD_DD
--------
ENABLED
SQL> alter session disable shard ddl;
Session altered.
SQL> select shard_ddl_status from v$session where AUDSID = userenv('SESSIONID');
SHARD_DD
--------
DISABLED
Filtering Data by Sharding Key
You can set the SHARD_QUERIES_RESTRICTED_BY_KEY
parameter
to enable or disable data filtering by a specified sharding key.
The parameter SHARD_QUERIES_RESTRICTED_BY_KEY
can be set
with ALTER
at the system or session level. If
enabled, DMLs will only display select data for specified
SHARDING_KEY
set in the client
connection.
In the following example, the client connection is established with a
shard with SHARDING_KEY
specified as "1". However,
when the client runs a SELECT
on the customers
table, all of the rows in that table in the shard are displayed.
connection established for client with sharding_key=1
SQL> select * from customers order by custno;
CUSTNO NAME ADDRESS LOCATION CLA
---------- ---------- ---------- ---------- ---
1 John Oracle KM Bangalore A
50 Larry Oracle HQ SFO B
2 rows selected.
SQL>
Now, as shown below, we enable session level filtering, and the result of
the same SELECT
statement is restricted to only the
single row that matches the SHARD_KEY
specified in
the client connection.
SQL> alter session set shard_queries_restricted_by_key = true;
Session altered.
SQL> select current_shard_key from dual;
CURRENT_SHARD_KEY
-----------------
1
1 row selected.
SQL> select * from customers;
CUSTNO NAME ADDRESS LOCATION CLA
---------- ---------- ---------- ---------- ---
1 John Oracle KM Bangalore A