diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3aa6119..c2ae081 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,154 +1,155 @@
+## 2.4.24
+
+### Added
+- Added support to list environment users.
+- Added support to list environment databases.
+- Fixed self-service snapshot list issue in dx_get_js_snapshots
+- Fixed dx_ctl_env to prevent adding same database twice for PostgreSQL
+
## 2.4.23
### Added
-- Support for Postgresql ( dSource / VDB )
+- Support for PostgreSQL (dSource/VDB)
- Data patch flag added for Oracle VDBs
## 2.4.22.1
### Changes
-- Fix to support backupuuid in dx_snapshot_db
-- Fix to support dots in the user names while using @DOMAIN or @SYSTEM
+- Fix to support backup UUID in dx_snapshot_db
+- Fix to support dots in usernames while using @DOMAIN or @SYSTEM
## 2.4.22
### Added
-- flag -cluster for dx_get_env and dx_get_db_env to display a cluster nodes for dSources and VDBs
-- support for Amazon Linux 2023
+- Flag -cluster for dx_get_env and dx_get_db_env to display cluster nodes for dSources and VDBs
+- Support for Amazon Linux 2023
-### Changes:
-- fix for dx_set_envpass to support MSSQL source environments
-- [bug #234](https://github.com/delphix/dxtoolkit/issues/234) - dx_ctl_user - fix for setting principal
+### Changes
+- Fix for dx_set_envpass to support MSSQL source environments
+- [Bug #234](https://github.com/delphix/dxtoolkit/issues/234) - dx_ctl_user - fix for setting principal
## 2.4.21.1
-### Changes:
-- group name added to dx_get_vdbthroughput - new parameter fullname
+### Changes
+- Group name added to dx_get_vdbthroughput - new parameter fullname
## 2.4.21
### Added
-- support for object level stats in the dx_get_capacity_history
+- Support for object level stats in dx_get_capacity_history
-### Changes:
-- compability with new engines (up to 16)
-- fixes in the timestamp support (-st) and (-et)
+### Changes
+- Compatibility with new engines (up to 16)
+- Fixes in the timestamp support (-st) and (-et)
## 2.4.20
### Added
-- support for Staging push ( MS SQL / Oracle )
-- [bug #232](https://github.com/delphix/dxtoolkit/issues/232) - dx_snapshot_db supports staging push
+- Support for Staging push (MS SQL/Oracle)
+- [Bug #232](https://github.com/delphix/dxtoolkit/issues/232) - dx_snapshot_db supports staging push
-### Changes:
-- [bug #230](https://github.com/delphix/dxtoolkit/issues/232) - example files location
-- compability with new engines (up to 12)
+### Changes
+- [Bug #230](https://github.com/delphix/dxtoolkit/issues/232) - Example files location
+- Compatibility with new engines (up to 12)
## 2.4.19.2
### Added
-- [bug #224](https://github.com/delphix/dxtoolkit/issues/224) - dx_get_hierarchy - print parent name
+- [Bug #224](https://github.com/delphix/dxtoolkit/issues/224) - dx_get_hierarchy - print parent name
## 2.4.19
-### Changes:
-- [bug #227](https://github.com/delphix/dxtoolkit/issues/227) - snapshot order fixed
-- [bug #226](https://github.com/delphix/dxtoolkit/issues/226) - link / unlink (attach / detech) works for vPDB and CDB
-- build fixes
+### Changes
+- [Bug #227](https://github.com/delphix/dxtoolkit/issues/227) - Snapshot order fixed
+- [Bug #226](https://github.com/delphix/dxtoolkit/issues/226) - Link/unlink (attach/detach) works for vPDB and CDB
+- Build fixes
### Added
-- [bug #225](https://github.com/delphix/dxtoolkit/issues/225) - support for vPDB/vCDB with TDE
-
+- [Bug #225](https://github.com/delphix/dxtoolkit/issues/225) - Support for vPDB/vCDB with TDE
## 2.4.18
### Added
-- [bug #206](https://github.com/delphix/dxtoolkit/issues/206) - dsource hooks support
-- [bug #217](https://github.com/delphix/dxtoolkit/issues/217) - dx_ctl_namespace added with option to failover and delete a namespace
-- [bug #220](https://github.com/delphix/dxtoolkit/issues/220) - Support for different metrics - MB/TB/GB/KB added to commands displaying space
-
-
-
-### Changes:
-- [bug #223](https://github.com/delphix/dxtoolkit/issues/223) - dx_ctl_js_container fix with return code
-- [bug #222](https://github.com/delphix/dxtoolkit/issues/222) - db_get_db_env backup is now generating proper output for masked child VDB
-- [bug #221](https://github.com/delphix/dxtoolkit/issues/221) - dbname for Oracle PDB can be now up to 30 characters
-- build fixes
-
+- [Bug #206](https://github.com/delphix/dxtoolkit/issues/206) - dSource hooks support
+- [Bug #217](https://github.com/delphix/dxtoolkit/issues/217) - dx_ctl_namespace added with options to failover and delete a namespace
+- [Bug #220](https://github.com/delphix/dxtoolkit/issues/220) - Support for different metrics (MB/TB/GB/KB) added to commands displaying space
+### Changes
+- [Bug #223](https://github.com/delphix/dxtoolkit/issues/223) - dx_ctl_js_container fix with return code
+- [Bug #222](https://github.com/delphix/dxtoolkit/issues/222) - dx_get_db_env backup is now generating proper output for masked child VDB
+- [Bug #221](https://github.com/delphix/dxtoolkit/issues/221) - dbname for Oracle PDB can now be up to 30 characters
+- Build fixes
## 2.4.17.2
-### Changes:
+### Changes
- dx_v2p - fix for MS SQL database to support file mapping
-- Fix for various commands for better support of Delphix Engine timezones ( ex. dx_get_jobs and similar )
+- Fix for various commands for better support of Delphix Engine timezones (e.g., dx_get_jobs and similar)
## 2.4.17
Breaking change
-If dx_ctl_replication script is used please review your scipts
-and add -action replicate to keep current functionality
+If dx_ctl_replication script is used, please review your scripts and add -action replicate to keep current functionality.
### Changes
-- dx_ctl_replication - Breaking change - More functionality (create/update/delete profile) has been added and parameter -action is required
-- dx_get_replication - backup of the replication profiles has been added
-- dx_get_osversion - fix
-- dx_get_config - backup of engine configuration to the JSON file has been added
-- fix to issue with some database names / comments
-- [bug #218](https://github.com/delphix/dxtoolkit/issues/218) - fix in dx_v2p
-- [bug #214](https://github.com/delphix/dxtoolkit/issues/214) - fix to no of CPU
-- [bug #208](https://github.com/delphix/dxtoolkit/issues/208) - fix to limited user privileges
+- dx_ctl_replication - Breaking change - More functionality (create/update/delete profile) has been added, and parameter -action is required
+- dx_get_replication - backup of the replication profiles has been added
+- dx_get_osversion - fix
+- dx_get_config - backup of engine configuration to the JSON file has been added
+- Fix to issue with some database names/comments
+- [Bug #218](https://github.com/delphix/dxtoolkit/issues/218) - Fix in dx_v2p
+- [Bug #214](https://github.com/delphix/dxtoolkit/issues/214) - Fix to number of CPU
+- [Bug #208](https://github.com/delphix/dxtoolkit/issues/208) - Fix to limited user privileges
### Added
-- dx_ctl_config - initialise and configure engine using JSON file
-- dx_get_namespace - list all replicated namespace
-- dx_ctl_namespace - failover or delete namespace
+- dx_ctl_config - initialize and configure engine using JSON file
+- dx_get_namespace - list all replicated namespaces
+- dx_ctl_namespace - failover or delete namespace
+
## 2.4.16.3
### Changes
-- fix to disable debug data in various scripts
-- [bug #215](https://github.com/delphix/dxtoolkit/issues/215) - v2p for MS SQL fix for 6.0.14 and higher
+- Fix to disable debug data in various scripts
+- [Bug #215](https://github.com/delphix/dxtoolkit/issues/215) - v2p for MS SQL fix for 6.0.14 and higher
+
## 2.4.16.2
### Added
- dx_get_osversion - will report an upgrade verification status
-- dx_get_appliance - will show UUID and engine type (masking / virtualisation )
+- dx_get_appliance - will show UUID and engine type (masking/virtualization)
## 2.4.16.0
### Added
- dx_get_db_env has a new column showing last VDB refresh time
-- TDE support for an Oracle MT
+- TDE support for Oracle MT
- OAuth2 support - Bearer token access
-
### Changed
- - dx_get_vdbsize - documentation fix
- - dx_ctl_env - set TDE password for CDB
- - dx_provision_db - support for Oracle MT TDE
- - dx_get_osversion - print upgrade verification results
+- dx_get_vdbsize - documentation fix
+- dx_ctl_env - set TDE password for CDB
+- dx_provision_db - support for Oracle MT TDE
+- dx_get_osversion - print upgrade verification results
## 2.4.15.1
### Added
-- [enhancement #194](https://github.com/delphix/dxtoolkit/issues/194) Last refresh date added to dx_get_db_env as a new column
-- dx_get_source_info is displaying now a status for Validated Sync opertion for MS SQL and Sybase
+- [Enhancement #194](https://github.com/delphix/dxtoolkit/issues/194) - Last refresh date added to dx_get_db_env as a new column
+- dx_get_source_info now displays a status for Validated Sync operation for MS SQL and Sybase
- dx_get_db_env has a new column showing last VDB refresh time
- dx_get_vdbsize - new script to display total storage used by VDB
-
### Changed
-- [bug #197](https://github.com/delphix/dxtoolkit/issues/197) dx_get_db_env is displaying now a parent snapshot / time of the parent dSource / VDB - not a rollback one
-- [bug #185](https://github.com/delphix/dxtoolkit/issues/185) dx_get_db_env is not displaying errors for replicated objects
-- [bug #190](https://github.com/delphix/dxtoolkit/issues/190) dx_provision_db works with None snapshot policy
-- [bug #198](https://github.com/delphix/dxtoolkit/issues/198) dx_get_source_info failing with vFiles dSources
-- [bug #199](https://github.com/delphix/dxtoolkit/issues/199) reserved space added to dx_get_appliance
-
+- [Bug #197](https://github.com/delphix/dxtoolkit/issues/197) - dx_get_db_env is now displaying a parent snapshot/time of the parent dSource/VDB - not a rollback one
+- [Bug #185](https://github.com/delphix/dxtoolkit/issues/185) - dx_get_db_env is not displaying errors for replicated objects
+- [Bug #190](https://github.com/delphix/dxtoolkit/issues/190) - dx_provision_db works with None snapshot policy
+- [Bug #198](https://github.com/delphix/dxtoolkit/issues/198) - dx_get_source_info failing with vFiles dSources
+- [Bug #199](https://github.com/delphix/dxtoolkit/issues/199) - Reserved space added to dx_get_appliance
## 2.4.14.1
@@ -161,19 +162,18 @@ and add -action replicate to keep current functionality
### Added
-- support for 6.0.11 engine
-- dx_ctl_engine_upgrade - action apply allows to select upgrade type - deferred or full
-- dx_ctl_engine_upgrade - action delete allows to delete old OS
-- dx_get_db_env new flag to speed up a command output for engines with many snapshots - dx_get_db_env -snappervdb
-- new filter based on repository name ( ORACLE_HOME, MS SQL instance, etc) added to dx_get_db_env and dx_ctl_db
+- Support for 6.0.11 engine
+- dx_ctl_engine_upgrade - action apply allows selection of upgrade type - deferred or full
+- dx_ctl_engine_upgrade - action delete allows deletion of old OS
+- dx_get_db_env - new flag to speed up command output for engines with many snapshots - dx_get_db_env -snappervdb
+- New filter based on repository name (ORACLE_HOME, MS SQL instance, etc.) added to dx_get_db_env and dx_ctl_db
### Changed
-- dx_ctl_engine_upgrade apply action fixed - it monitors now a whole upgrade process, including engine reboot
-- [fix for #195](https://github.com/delphix/dxtoolkit/issues/195) - this was generic issue with snapshot paging
-- [fix for #193](https://github.com/delphix/dxtoolkit/issues/193) - dx_get_env creates different envtype than what dx_create_env expects
-- fix for backup metadata in dx_get_db_env
-- fix for printing hierarchy in dx_get_hierarchy for objects with same reference across 2 engines
-
+- dx_ctl_engine_upgrade apply action fixed - it now monitors the whole upgrade process, including engine reboot
+- [Fix for #195](https://github.com/delphix/dxtoolkit/issues/195) - generic issue with snapshot paging
+- [Fix for #193](https://github.com/delphix/dxtoolkit/issues/193) - dx_get_env creates a different envtype than what dx_create_env expects
+- Fix for backup metadata in dx_get_db_env
+- Fix for printing hierarchy in dx_get_hierarchy for objects with the same reference across two engines
## 2.4.13
@@ -181,23 +181,22 @@ and add -action replicate to keep current functionality
- Support for Commvault in adding MSSQL dSource
### Changed
-- remove bookmark in self service fix
-- fix for snapshot size reporting
-
+- Remove bookmark in self-service fix
+- Fix for snapshot size reporting
## 2.4.12
### Added
-- skipdefault flag added to dx_ctl_policy to skip updating existing default polices
-- [fix for #180](https://github.com/delphix/dxtoolkit/issues/180) - exclude parameter added to dx_ctl_dsource to ingest vfiles with exclude list
-- support for password passed through environment variable - see example config file
-- support for password passed via external script - see example config file
+- Skipdefault flag added to dx_ctl_policy to skip updating existing default policies
+- [Fix for #180](https://github.com/delphix/dxtoolkit/issues/180) - Exclude parameter added to dx_ctl_dsource to ingest vFiles with exclude list
+- Support for password passed through environment variable - see example config file
+- Support for password passed via external script - see example config file
### Changed
-- fix for applying policy to group
-- fix to uploading upgrade in engines in version 6.0.X
-- fix for same users in DOMAIN and SYSTEM with dash in name
-- [fix for #181](https://github.com/delphix/dxtoolkit/issues/181) Fix for disable / enbable LogSync
+- Fix for applying policy to group
+- Fix to uploading upgrade in engines in version 6.0.X
+- Fix for same users in DOMAIN and SYSTEM with dash in the name
+- [Fix for #181](https://github.com/delphix/dxtoolkit/issues/181) - Fix for disable/enable LogSync
## 2.4.11
diff --git a/bin/dx_ctl_env.pl b/bin/dx_ctl_env.pl
index 538f13f..0c3c936 100755
--- a/bin/dx_ctl_env.pl
+++ b/bin/dx_ctl_env.pl
@@ -412,6 +412,31 @@
my %plugin_params_hash = (
"name" => $dbname
);
+
+ my $dbarray = $sourceconfig_obj->getSourceConfigsListForRepo($repo->{reference});
+ my $sourceconfig;
+ my $existing_db_name;
+ my $db_exist = 0;
+
+ for my $dbitem (@{$dbarray}) {
+ $sourceconfig = $sourceconfig_obj->getSourceConfig($dbitem);
+ if (defined($sourceconfig->{'toolkit'})) {
+ $existing_db_name = $sourceconfig_obj->getName($dbitem);
+ } else {
+ $existing_db_name = $sourceconfig_obj->getSourceConfig($dbitem)->{'databaseName'};
+ }
+ if ($dbname eq $existing_db_name) {
+ print "Database $dbname already exist. Skipping\n";
+ $ret = $ret + 1;
+ $db_exist = 1;
+ last;
+ }
+ }
+
+ if ($db_exist == 1) {
+ next;
+ }
+
if ($sourceconfig_obj->createSourceConfig('plugin', $repo->{reference}, $dbname, \%native_params, \%plugin_params_hash)) {
print "Can't add Postgresql $dbname \n";
$ret = $ret + 1;
diff --git a/bin/dx_get_env.pl b/bin/dx_get_env.pl
index 6d9bb2a..16d80a6 100755
--- a/bin/dx_get_env.pl
+++ b/bin/dx_get_env.pl
@@ -40,6 +40,8 @@
use Toolkit_helpers;
use Repository_obj;
use Host_obj;
+use SourceConfig_obj;
+use Databases;
my $version = $Toolkit_helpers::version;
@@ -53,6 +55,8 @@
'cluster' => \(my $cluster),
'backup=s' => \(my $backup),
'replist' => \(my $replist),
+ 'sourcelist' => \(my $sourcelist),
+ 'dbname=s' => \(my $dbname),
'nohead' => \(my $nohead),
'format=s' => \(my $format),
'debug:i' => \(my $debug),
@@ -75,6 +79,12 @@
exit (1);
}
+if (defined($dbname) && (!defined($envname))) {
+ print "Option -dbname requires environemnt name -name to be specified \n";
+ pod2usage(-verbose => 1, -input=>\*DATA);
+ exit (1);
+}
+
# this array will have all engines to go through (if -d is specified it will be only one engine)
my $engine_list = Toolkit_helpers::get_engine_list($all, $dx_host, $engine_obj);
@@ -104,7 +114,17 @@
{'Environment Name', 30},
{'Repository list', 30}
);
-} elsif (defined($config)) {
+} elsif (defined($sourcelist)) {
+ $output->addHeader(
+ {'Appliance', 20},
+ {'Environment Name', 30},
+ {'Repository', 30},
+ {'DB name', 30},
+ {'DB type', 30},
+ {'dSource/VDB', 10},
+ {'dSource/VDB name', 30}
+ );
+}elsif (defined($config)) {
$output->addHeader(
{'Appliance', 20},
{'Environment Name', 30},
@@ -134,7 +154,8 @@
{'Environment Name', 30},
{'Type', 25},
{'Status', 8},
- {'OS Version', 50}
+ {'OS Version', 50},
+ {'Environment Users', 30}
);
}
@@ -152,10 +173,24 @@
};
# load objects for current engine
- my $environments = new Environment_obj( $engine_obj, $debug);
- my $repository_obj = new Repository_obj($engine_obj, $debug);
- my $host_obj = new Host_obj ( $engine_obj, $debug );
-
+ my $environments;
+ my $repository_obj;
+ my $host_obj;
+ my $toolkits;
+ my $sourceconfigs;
+ my $databases;
+
+ if (defined($sourcelist)) {
+ $toolkits = new Toolkit_obj($engine_obj, $debug);
+ $databases = new Databases( $engine_obj, $debug );
+ $sourceconfigs = $databases->{_sourceconfigs};
+ $environments = $databases->{_environments};
+ $repository_obj = $databases->{_repositories};
+ } else {
+ $environments = new Environment_obj( $engine_obj, $debug);
+ $repository_obj = new Repository_obj($engine_obj, $debug);
+ $host_obj = new Host_obj ( $engine_obj, $debug );
+ }
# filter implementation
@@ -185,83 +220,16 @@
for my $envitem ( @env_list ) {
if (defined($userlist)) {
- $output->addLine(
- $engine,
- $environments->getName($envitem),
- '*' . $environments->getPrimaryUserName($envitem),
- $environments->getPrimaryUserAuth($envitem)
- );
- for my $useritem (@{$environments->getEnvironmentNotPrimaryUsers($envitem)}) {
- $output->addLine(
- '',
- '',
- $environments->getEnvironmentUserNamebyRef($envitem,$useritem),
- $environments->getEnvironmentUserAuth($envitem,$useritem)
- );
- }
+ print_users($output, $engine, $environments, $envitem);
} elsif (defined($replist)) {
- $output->addLine(
- $engine,
- $environments->getName($envitem),
- ''
- );
- my $reparray = $repository_obj->getRepositoryByEnv($envitem);
- for my $repitem (@{$reparray}) {
- $output->addLine(
- '',
- '',
- $repository_obj->getName($repitem)
- );
- }
-
+ print_repo($output, $engine, $environments, $envitem, $repository_obj);
+ } elsif (defined($sourcelist)) {
+ $ret = $ret + print_source($output, $engine, $envitem, $databases, $toolkits, $dbname);
} elsif (defined($config) || defined($backup)) {
-
- my $envtype = $environments->getType($envitem);
- my $host_ref = $environments->getHost($envitem);
- my $envname = $environments->getName($envitem);
- my $userauth = $environments->getPrimaryUserAuth($envitem);
- my $hostname;
- my $user = $environments->getPrimaryUserName($envitem);
-
- if (($host_ref ne 'CLUSTER') && ($host_ref ne 'NA')) {
- $hostname = $host_obj->getHostAddr($host_ref);
- } else {
- my $clusenvnode = $environments->getClusterNode($envitem);
- $host_ref = $environments->getHost($clusenvnode);
- $hostname = $host_obj->getHostAddr($host_ref);
- }
-
-
-
- if (defined($backup)) {
-
- my $backup = $environments->getBackup($envitem, $host_obj, $engine, $envname, $envtype, $hostname, $user, $userauth);
- $output->addLine(
- $backup
- );
-
- #add users
-
- $environments->getUsersBackup($envitem,$output,$engine);
-
-
-
- } else {
-
- $config = $environments->getConfig($envitem, $host_obj);
- $output->addLine(
- $engine,
- $envname,
- $envtype,
- $hostname,
- $user,
- $userauth,
- $config
- );
-
- }
+ gen_backup_config($output, $engine, $environments, $envitem, $backup, $host_obj);
} else {
my $cluster_nodes;
+ my $user = $environments->getPrimaryUserName($envitem);
my $host_ref = $environments->getHost($envitem);
my $hostos;
if (($host_ref ne 'CLUSTER') && ($host_ref ne 'NA')) {
@@ -285,16 +253,21 @@
$hostos,
$cluster_nodes
);
- } else {
- $output->addLine(
- $engine,
- $environments->getName($envitem),
- $environments->getType($envitem),
- $environments->getStatus($envitem),
- $hostos
- );
}
- }
+ else {
+ my $users = join(";", map { $environments->getEnvironmentUserNamebyRef($envitem,$_) } @{$environments->getEnvironmentNotPrimaryUsers($envitem)});
+ $users = '*' . $environments->getPrimaryUserName($envitem) . ';' . $users;
+ $output->addLine(
+ $engine,
+ $environments->getName($envitem),
+ $environments->getType($envitem),
+ $environments->getStatus($envitem),
+ $hostos,
+ $users
+ );
+
+ }
+}
$save_state{$envitem} = $environments->getStatus($envitem);
@@ -328,7 +301,226 @@
exit $ret;
+sub print_users {
+ my $output = shift;
+ my $engine = shift;
+ my $environments = shift;
+ my $envitem = shift;
+
+ $output->addLine(
+ $engine,
+ $environments->getName($envitem),
+ '*' . $environments->getPrimaryUserName($envitem),
+ $environments->getPrimaryUserAuth($envitem)
+ );
+ for my $useritem (@{$environments->getEnvironmentNotPrimaryUsers($envitem)}) {
+ $output->addLine(
+ '',
+ '',
+ $environments->getEnvironmentUserNamebyRef($envitem,$useritem),
+ $environments->getEnvironmentUserAuth($envitem,$useritem)
+ );
+ }
+}
+
+sub print_repo {
+ my $output = shift;
+ my $engine = shift;
+ my $environments = shift;
+ my $envitem = shift;
+ my $repository_obj = shift;
+
+ $output->addLine(
+ $engine,
+ $environments->getName($envitem),
+ ''
+ );
+ my $reparray = $repository_obj->getRepositoryByEnv($envitem);
+ for my $repitem (@{$reparray}) {
+ $output->addLine(
+ '',
+ '',
+ $repository_obj->getName($repitem)
+ );
+ }
+}
+
+sub print_source {
+ my $output = shift;
+ my $engine = shift;
+ my $envitem = shift;
+ my $databases = shift;
+ my $toolkits = shift;
+ my $filter_db_name = shift;
+
+ my $sourceconfigs = $databases->{_sourceconfigs};
+ my $environments = $databases->{_environments};
+ my $repository_obj = $databases->{_repositories};
+ my $sources = $databases->{_source};
+
+ my $envname = $environments->getName($envitem);
+
+
+ my $rdbms;
+ my $sourceconfig;
+ my $source;
+ my $dbobj;
+ my $reponame;
+ my $dbname;
+ my $dbtype;
+ my $delphixname;
+ my $ret = 0;
+
+ my $reparray = $repository_obj->getRepositoryByEnv($envitem);
+ for my $repitem (@{$reparray}) {
+ $reponame = $repository_obj->getName($repitem);
+ my $dbarray = $sourceconfigs->getSourceConfigsListForRepo($repitem);
+
+ my @outputdbarray;
+ my $outputdbarray_pointer;
+ if (defined($filter_db_name)) {
+ for my $dbitem (@{$dbarray}) {
+ $sourceconfig = $sourceconfigs->getSourceConfig($dbitem);
+ if (defined($sourceconfig->{'toolkit'})) {
+ $dbname = $sourceconfigs->getName($dbitem);
+ } else {
+ $dbname = $sourceconfigs->getSourceConfig($dbitem)->{'databaseName'};
+ }
+ if ($dbname eq $filter_db_name) {
+ push(@outputdbarray, $dbitem);
+ }
+ }
+ if (scalar(@outputdbarray)>0) {
+ $ret = 0;
+ } else {
+ $ret = 1;
+ }
+ $outputdbarray_pointer = \@outputdbarray;
+
+ } else {
+ $outputdbarray_pointer = $dbarray;
+ }
+
+ for my $dbitem (@{$outputdbarray_pointer}) {
+ # print Dumper "databases";
+ # print Dumper $dbitem;
+ # print Dumper $sourceconfigs->getName($dbitem);
+ # print Dumper $sourceconfigs->getSourceConfig($dbitem)->{'databaseName'};
+
+ # $dbname = 'slon';
+
+ $sourceconfig = $sourceconfigs->getSourceConfig($dbitem);
+ if (defined($sourceconfig->{'toolkit'})) {
+ if ($toolkits->getName($sourceconfig->{'toolkit'}) eq 'postgres-vsdk') {
+ $rdbms = 'postgresql';
+ } elsif ($toolkits->getName($sourceconfig->{'toolkit'}) eq 'db2db') {
+ $rdbms = 'db2';
+ } else {
+ $rdbms = 'unknown';
+ }
+ $dbname = $sourceconfigs->getName($dbitem);
+ } else {
+ $dbname = $sourceconfigs->getSourceConfig($dbitem)->{'databaseName'};
+ if ($dbitem =~ /^MSSQL/) {
+ $rdbms = "mssql";
+ } elsif ($dbitem =~ /^ORACLE/) {
+ if (defined($sourceconfig->{'cdbType'})) {
+ if ($sourceconfig->{'cdbType'} eq 'NON_CDB') {
+ $rdbms = "oracle";
+ } elsif ($sourceconfig->{'cdbType'} eq 'ROOT_CDB') {
+ $rdbms = "oracle CDB";
+ }
+ } elsif (defined($sourceconfig->{'cdbConfig'})) {
+ $rdbms = "oracle PDB";
+ } else {
+ $rdbms = "unknown oracle";
+ }
+ } elsif ($dbitem =~ /^ASE/) {
+ $rdbms = "sybase";
+ }
+ }
+
+ $source = $sources->getSourceByConfig($dbitem);
+ if (defined($source)) {
+ $dbobj = $databases->getDB($source->{'container'});
+ $delphixname = $dbobj->getName();
+ $dbtype = $dbobj->getType();
+ } else {
+ # not ingested
+ $dbtype = '';
+ $delphixname = 'not ingested';
+ }
+
+
+
+ $output->addLine(
+ $engine,
+ $envname,
+ $reponame,
+ $dbname,
+ $rdbms,
+ $dbtype,
+ $delphixname
+ )
+ }
+ }
+
+ return $ret;
+}
+
+sub gen_backup_config {
+ my $output = shift;
+ my $engine = shift;
+ my $environments = shift;
+ my $envitem = shift;
+ my $backup = shift;
+ my $host_obj = shift;
+
+ my $envtype = $environments->getType($envitem);
+ my $host_ref = $environments->getHost($envitem);
+ my $envname = $environments->getName($envitem);
+ my $userauth = $environments->getPrimaryUserAuth($envitem);
+ my $hostname;
+ my $user = $environments->getPrimaryUserName($envitem);
+
+ if (($host_ref ne 'CLUSTER') && ($host_ref ne 'NA')) {
+ $hostname = $host_obj->getHostAddr($host_ref);
+ } else {
+ my $clusenvnode = $environments->getClusterNode($envitem);
+ $host_ref = $environments->getHost($clusenvnode);
+ $hostname = $host_obj->getHostAddr($host_ref);
+ }
+
+
+
+ if (defined($backup)) {
+
+ my $backup = $environments->getBackup($envitem, $host_obj, $engine, $envname, $envtype, $hostname, $user, $userauth);
+ $output->addLine(
+ $backup
+ );
+
+ #add users
+
+ $environments->getUsersBackup($envitem,$output,$engine);
+
+
+
+ } else {
+
+ $config = $environments->getConfig($envitem, $host_obj);
+ $output->addLine(
+ $engine,
+ $envname,
+ $envtype,
+ $hostname,
+ $user,
+ $userauth,
+ $config
+ );
+ }
+}
__DATA__
=head1 SYNOPSIS
@@ -337,7 +529,9 @@ =head1 SYNOPSIS
[-name env_name | -reference reference ]
[-backup]
[-replist ]
+ [-userlist ]
[-cluster ]
+ [-sourcelist [-dbname name]]
[-format csv|json ]
[-help|? ]
[-debug ]
@@ -394,6 +588,14 @@ =head1 OPTIONS
=item B<-cluster>
Print ; segrageted list of cluster nodes from the environment into a new column called cluster nodes
+=item B<-userlist>
+Print list of user for each environment
+
+=item B<-sourcelist>
+Print list of source databases ( discovered or added )
+
+=item B<-dbname name>
+Print source database(s) with the "name"
=item B<-format>
Display output in csv or json format
@@ -413,13 +615,15 @@ =head1 EXAMPLES
dx_get_env -d Landshark
- Appliance Reference Environment Name Type Status
- -------------------- ------------------------------ ------------------------------ ------------------------- --------
- Landshark5 ORACLE_CLUSTER-11 racattack-cl rac enabled
- Landshark5 UNIX_HOST_ENVIRONMENT-1 LINUXTARGET unix enabled
- Landshark5 UNIX_HOST_ENVIRONMENT-44 LINUXSOURCE unix enabled
- Landshark5 WINDOWS_HOST_ENVIRONMENT-48 WINDOWSTARGET windows enabled
- Landshark5 WINDOWS_HOST_ENVIRONMENT-49 WINDOWSSOURCE windows enabled
+ Appliance Environment Name Type Status OS Version Environment Users
+ -------------------- ------------------------------ ------------------------- -------- -------------------------------------------------- ------------------------------
+ dxtest marcinsybasesrc.xxx.com unix enabled Red Hat Enterprise Linux release 8.3 (Ootpa) *sybase;
+ dxtest marcinorasrc.xxx.com unix enabled Red Hat Enterprise Linux Server release 7.8 (Maipo *oracle;oracle2
+ dxtest marcinposttgt.xxx.com unix enabled Red Hat Enterprise Linux release 8.6 (Ootpa) *postgres;
+ dxtest marcinoratgt.xxx.com unix enabled Red Hat Enterprise Linux Server release 7.8 (Maipo *oracle;
+ dxtest marcinsybasetgt.xxx.com unix enabled Red Hat Enterprise Linux release 8.3 (Ootpa) *sybase;
+ dxtest marcinmssqltgt.xxx.com windows enabled Windows Server 2016 Standard *QA-AD\ADuser;
+ dxtest marcinmssqlsrc.xxx.com windows enabled Windows Server 2016 Standard *QA-AD\ADuser;
Display all environments with repositories list
@@ -446,6 +650,71 @@ =head1 EXAMPLES
MSSQLSERVER
MSSQL2012
-
+Display all environments with cluster list
+
+dx_get_env -d Landshark -cluster
+
+ Appliance Environment Name Type Status OS Version Hostname
+ -------------------- ------------------------------ ------------------------- --------------- -------------------------------------------------------- ---------------------
+ Landshark5 racattack-cl rac enabled Red Hat Enterprise Linux Server release 7.9 (Maipo) server1;10.***.**.01
+ Landshark5 LINUXTARGET unix enabled Red Hat Enterprise Linux Server release 7.9 (Maipo) server2;10.***.**.02
+ Landshark5 LINUXSOURCE unix enabled Red Hat Enterprise Linux Server release 7.9 (Maipo) server3;10.***.**.03
+ Landshark5 WINDOWSTARGET windows enabled Red Hat Enterprise Linux Server release 7.9 (Maipo) server4;10.***.**.04
+ Landshark5 WINDOWSSOURCE windows enabled Red Hat Enterprise Linux Server release 7.9 (Maipo) server5;10.***.**.05
+
+
+Display all environments with user list
+
+dx_get_env -d Landshark -userlist
+
+ Appliance Environment Name User name Status Auth Type
+ -------------------- ------------------------------ ----------------------- --------------- ---------------
+ Landshark5 racattack-cl *delphix enabled password
+ Landshark5 LINUXTARGET *delphix enabled password
+ Landshark5 LINUXSOURCE *delphix enabled systemkey
+ Landshark5 WINDOWSTARGET *delphix enabled password
+ Landshark5 WINDOWSSOURCE *delphix enabled systemkey
+
+
+Display all databases
+
+ dx_get_env -d dxtest -sourcelist
+
+ Appliance Environment Name Repository DB name DB type dSource/VD dSource/VDB name
+ -------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------- ------------------------------
+ dxtest marcinsybasesrc.xxx.com ASE160_SRC db_rhel83_160_0 sybase not ingested
+ dxtest marcinsybasesrc.xxx.com ASE160_SRC db_rhel83_160_1 sybase dSource db_rhel83_160_1
+ dxtest marcinsybasesrc.xxx.com ASE160_SRC db_rhel83_160_2 sybase not ingested
+ dxtest marcinsybasesrc.xxx.com ASE160_SRC db_rhel83_160_3 sybase not ingested
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 ORACLEXXCA1DPDB1 oracle PDB dSource ORACLEXXCA1DPDB1
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 ORACLEXXCA1DPDB2 oracle PDB not ingested
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 ORACLEXXCA1DPDB3 oracle PDB not ingested
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 ORACLESI oracle dSource ORACLESI85E9
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 ORACLEXX oracle CDB CDB CDOMLOSRCA1D
+ dxtest marcinorasrc.xxx.com /u01/app/oracle/product/19.0.0 CDOMSHSR oracle CDB CDB CDOMSHSRF517
+ dxtest marcinposttgt.xxx.com Postgres vFiles (15.2) Postgres-5444 - /mnt/provision postgresql VDB postsing
+ dxtest marcinposttgt.xxx.com Postgres vFiles (15.2) Postgres-5445 - /mnt/provision postgresql VDB post
+ dxtest marcinposttgt.xxx.com Postgres vFiles (15.2) singledb postgresql dSource singledb
+ dxtest marcinposttgt.xxx.com Postgres vFiles (15.2) postds postgresql dSource postds
+ dxtest marcinposttgt.xxx.com Postgres vFiles (15.2) dxttest3 postgresql not ingested
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 tdetest oracle PDB VDB tdetest
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 pdbtest oracle PDB VDB pdbtest
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 pdbtest2 oracle PDB VDB pdbtest2
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 oratest oracle VDB oratest
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 oratest2 oracle VDB oratest2
+ dxtest marcinsybasetgt.xxx.com ASE160_TGT dxrnuv2Prvcrr93H7A_l83_160_1 sybase dSource db_rhel83_160_1
+ dxtest marcinsybasetgt.xxx.com ASE160_TGT sybasetest sybase VDB sybasetest
+ dxtest marcinmssqltgt.xxx.com SQL2016 dummystg mssql dSource dummystg
+ dxtest marcinmssqltgt.xxx.com SQL2016 ec2d3f84-b46d-75e3-0c32-04d637 mssql dSource SourceXYZ
+ dxtest marcinmssqltgt.xxx.com SQL2016 mssqltest mssql VDB mssqltest
+ dxtest marcinmssqlsrc.xxx.com SQL2016 SourceXYZ mssql dSource SourceXYZ
+
+Test if one database have been discovered on the environment
+
+ dx_get_env -d dxtest -sourcelist -dbname oratest -name marcinoratgt.xxx.com
+
+ Appliance Environment Name Repository DB name DB type dSource/VD dSource/VDB name
+ -------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------- ------------------------------
+ dxtest marcinoratgt.xxx.com /u01/app/oracle/product/19.0.0 oratest oracle VDB oratest
=cut
diff --git a/bin/dx_get_js_snapshots.pl b/bin/dx_get_js_snapshots.pl
index fd51aad..0acc14f 100644
--- a/bin/dx_get_js_snapshots.pl
+++ b/bin/dx_get_js_snapshots.pl
@@ -102,7 +102,8 @@
{'Bookmark snapshot', 30},
{Toolkit_helpers::get_unit('Bookmark snap size',$output_unit), 20},
{'Parent snapshot', 30},
- {Toolkit_helpers::get_unit('Parent snap size',$output_unit), 20}
+ {Toolkit_helpers::get_unit('Parent snap size',$output_unit), 20},
+ {'Parent name', 30}
);
@@ -179,8 +180,7 @@
my $tfrangearray;
my %timeflowranges;
-
-
+ my $parentname;
for my $dbref (keys %dbarray) {
@@ -191,6 +191,7 @@
# load database snapshots for parent
my $dbobj = $databases->getDB($dbref);
my $snapshots = new Snapshot_obj( $engine_obj, $dbobj->getParentContainer(), undef, $debug);
+ $snapshots->getSnapshotList($dbobj->getParentContainer());
$snapshots->getSnapshotList(keys %dbarray);
# for all timeflows generate timeflow range for bookmarks,
@@ -223,6 +224,7 @@
if (!defined($snapshotname)) {
$snapshotname = "deleted";
$snapsize = 'N/A';
+ $parentname = 'N/A';
} else {
if (!defined($snapshot_sizes{$snapref})) {
$snapsize = $snapshots->getSnapshotSize($snapref);
@@ -235,6 +237,7 @@
} else {
$snapsize = $snapshot_sizes{$snapref};
}
+ $parentname = $databases->getDB($snapshots->getSnapshotContainer($snapref))->getName();
}
if (defined($operation_for_conttf)) {
@@ -251,7 +254,8 @@
'N/A',
'N/A',
$snapshotname,
- $snapsize
+ $snapsize,
+ $parentname
);
} else {
$output->addLine(
@@ -264,7 +268,8 @@
'N/A',
'N/A',
$snapshotname,
- $snapsize
+ $snapsize,
+ $parentname
);
}
@@ -356,7 +361,9 @@
if (!defined($parentsnapshotname)) {
$parentsnapshotname = "deleted";
$parentsnapsize = 'N/A';
+ $parentname = 'N/A';
} else {
+ $parentname = $databases->getDB($snapshots->getSnapshotContainer($parentsnapshotref))->getName();
if (!defined($snapshot_sizes{$parentsnapshotref})) {
$parentsnapsize = $snapshots->getSnapshotSize($parentsnapshotref);
if (defined($parentsnapsize)) {
@@ -393,7 +400,8 @@
$contsnapshotname,
$snapsize,
$parentsnapshotname,
- $parentsnapsize
+ $parentsnapsize,
+ $parentname
);
diff --git a/lib/Engine.pm b/lib/Engine.pm
index 888d6dc..91156bf 100644
--- a/lib/Engine.pm
+++ b/lib/Engine.pm
@@ -972,7 +972,7 @@ sub login {
}
);
} else {
- # keep this for backward compability of dxtools.conf file
+ # keep this for backward compatibility of dxtools.conf file
# if sysadmin is defined there we need to be able to login
%mylogin =
(
diff --git a/lib/Replication_obj.pm b/lib/Replication_obj.pm
index 3c4fd4b..74c6f1d 100644
--- a/lib/Replication_obj.pm
+++ b/lib/Replication_obj.pm
@@ -1014,44 +1014,6 @@ sub setEnabled {
}
-# Procedure setType
-# parameters:
-# - repobj
-# - type
-# Set a proper objectlist type
-
-# sub setType {
-# my $self = shift;
-# my $repobj = shift;
-# my $type = shift;
-
-# logger( $self->{_debug}, "Entering Replication_obj::setType", 1 );
-# if (lc $type eq 'replica') {
-# $repobj->{"objectSpecification"}->{type} = 'ReplicationList';
-# } elsif (lc $type eq 'sdd') {
-# $repobj->{"objectSpecification"}->{type} = 'ReplicationSecureList';
-# } else {
-# print Dumper "wrong type";
-# return undef;
-# }
-# }
-
-
-# {
-# "type": "ReplicationSpec",
-# "name": "dupazbita",
-# "targetHost": "10.0.0.1",
-# "targetPrincipal": "admin",
-# "targetCredential": {
-# "type": "PasswordCredential",
-# "password": "dupa"
-# },
-# "objectSpecification": {
-# "type": "ReplicationList",
-# "objects": [
-# "ORACLE_DB_CONTAINER-5"
-# ]
-# }
-# }
+
1;
diff --git a/lib/Snapshot_obj.pm b/lib/Snapshot_obj.pm
index 0e9ab1f..dae456d 100644
--- a/lib/Snapshot_obj.pm
+++ b/lib/Snapshot_obj.pm
@@ -38,7 +38,6 @@ use Toolkit_helpers qw (logger);
# - container - database reference
# - debug - debug flag (debug on if defined)
-
sub new {
my $classname = shift;
my $dlpxObject = shift;
@@ -92,7 +91,7 @@ sub getContainer {
sub getSnapshotContainer {
my $self = shift;
my $reference = shift;
- logger($self->{_debug}, "Entering Snapshot_obj::getContainer",1);
+ logger($self->{_debug}, "Entering Snapshot_obj::getSnapshotContainer",1);
return $self->{_snapshots}->{$reference}->{container};
}
diff --git a/lib/Timeflow_obj.pm b/lib/Timeflow_obj.pm
index 0b17fb5..a139d0c 100644
--- a/lib/Timeflow_obj.pm
+++ b/lib/Timeflow_obj.pm
@@ -95,7 +95,6 @@ sub getParentSnapshot {
$snap = $self->{_timeflows}->{$reference}->{parentSnapshot};
}
}
-
return defined($snap) ? $snap : '';
}
@@ -598,13 +597,16 @@ sub findParentTimeflow
my $parent;
my $topchild;
my $stop = 0;
+ my $clean_parent;
- logger($self->{_debug}, "Find parent timeflow for " . $ref, 2);
+ my $local_ref = $ref . "\@l";
+ logger($self->{_debug}, "Find parent timeflow for " . $local_ref, 2);
my $ref_container = $self->getContainer($ref);
do {
- $parent = $hier->{$ref}->{parent};
+ $parent = $hier->{$local_ref}->{parent};
+ ($clean_parent) = $parent =~ /(.*)\@l/;
if (!defined($parent) || ($parent eq 'deleted')) {
# for JS issue - ex. parent was deleted - can happen if container created from not refreshed VDB
@@ -614,14 +616,13 @@ sub findParentTimeflow
$stop = 1;
} else {
logger($self->{_debug}, "Parent " . $parent . " for " . $ref, 2);
- # print Dumper "Parent " . $parent . " for " . $ref;
- if ($self->getContainer($parent) ne $ref_container) {
+ if ($self->getContainer($clean_parent) ne $ref_container) {
$topchild = $ref;
- $retparent = $parent;
+ $retparent = $clean_parent;
$stop = 1;
} else {
$topchild = $ref;
- $ref = $parent;
+ $local_ref = $parent;
}
}
diff --git a/lib/Toolkit_helpers.pm b/lib/Toolkit_helpers.pm
index 10c462c..a3ed2eb 100644
--- a/lib/Toolkit_helpers.pm
+++ b/lib/Toolkit_helpers.pm
@@ -29,7 +29,7 @@ use File::Spec;
use lib '../lib';
-our $version = '2.4.23';
+our $version = '2.4.24';
my $tz = new Date::Manip::TZ;
my $dt = new Date::Manip::Date;
diff --git a/test/test_env/env.t b/test/test_env/env.t
index 5d29648..793234e 100644
--- a/test/test_env/env.t
+++ b/test/test_env/env.t
@@ -1,6 +1,6 @@
use strict;
use Data::Dumper;
-use Test::More tests => 12;
+use Test::More tests => 14;
use Test::Script;
use Test::Files;
use File::Spec;
@@ -23,9 +23,9 @@ script_compiles('../../bin/dx_get_env.pl');
script_runs(['../../bin/dx_get_env.pl', '-d', 'local', '-format','csv', "list environments"]);
my $expected_stdout = <catfile( "./backup_env_orig.txt" );
compare_ok($some_file, $other_file, "backup file looks OK");
+script_runs(['../../bin/dx_get_env.pl', '-d', 'local', '-format','csv', '-userlist', "list users"]);
+$expected_stdout = <host('127.0.0.1');
$server2->background();
-
-# $server->set_dir('dupazbita');
-# my $ala = $server->get_dir();
-#
-# print Dumper $ala;
-#
-# exit(1);
-
script_compiles('../../bin/dx_get_hierarchy.pl');
script_runs(['../../bin/dx_get_hierarchy.pl', '-d', 'local32', '-format','csv','-nohead'] , "All hierachy test");