2023年2月15日 星期三

2023年2月9日 星期四

vmware 資料存放區無法存取

 https://vmninja.wordpress.com/2019/04/05/remove-inaccessible-datastore-from-inventory/

https://dotblogs.com.tw/mardukblog/2019/12/26/vmware_1


Command> shell

Shell access is granted to root

root@acc-vc [ ~ ]# /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres

psql.bin (9.6.11 (VMware Postgres 9.6.11.0-11269216 release))

Type "help" for help.


VCDB=# select * from vpx_entity where name = '203.68.4.112-ActiveBackupforBusiness'

VCDB-# select * from vpx_entity

VCDB-# selevt * from vpx_entity

VCDB-# \d

                           List of relations

 Schema |                    Name                    |   Type   | Owner 

--------+--------------------------------------------+----------+-------

 vc     | cis_kv_keyvalue                            | table    | vc

 vc     | cis_kv_keyvalue_surr_key_seq               | sequence | vc

 vc     | cis_kv_providers                           | table    | vc

 vc     | cis_kv_providers_surr_key_seq              | sequence | vc

 vc     | cl_checkout                                | table    | vc

 vc     | cl_config                                  | table    | vc

 vc     | cl_dbversion                               | table    | vc

 vc     | cl_dirty_marker                            | table    | vc

 vc     | cl_entity_lock                             | table    | vc

 vc     | cl_entity_lock_metadata                    | table    | vc

 vc     | cl_file                                    | table    | vc

 vc     | cl_file_version                            | table    | vc

 vc     | cl_item_ovftemplate_view                   | view     | vc

 vc     | cl_item_type_adapter                       | table    | vc

 vc     | cl_item_vmtx_template_view                 | view     | vc

 vc     | cl_library                                 | table    | vc

 vc     | cl_library_storage                         | table    | vc

 vc     | cl_libraryitem                             | table    | vc

 vc     | cl_libraryitemhistory                      | table    | vc

 vc     | cl_libraryitemversion                      | table    | vc

 vc     | cl_libraryitemversionfile_view             | view     | vc

 vc     | cl_librarywithitems_view                   | view     | vc

 vc     | cl_metadata                                | table    | vc

 vc     | cl_orphan_file                             | table    | vc

 vc     | cl_simple_activity                         | table    | vc

 vc     | cl_simple_activity_parameter               | table    | vc

 vc     | cl_sq_dirty_marker_id                      | sequence | vc

 vc     | cl_storage                                 | table    | vc

 vc     | cl_subscription                            | table    | vc

 vc     | cl_update_session_file                     | table    | vc

 vc     | cl_vcenter_task                            | table    | vc

 vc     | iso_vcenter_task                           | table    | vc

 vc     | ovf_vcenter_task                           | table    | vc

 vc     | vdc_entity_lock                            | table    | vc

 vc     | vdc_entity_lock_metadata                   | table    | vc

 vc     | vdc_simple_activity                        | table    | vc

 vc     | vdc_simple_activity_parameter              | table    | vc

 vc     | vpx_access                                 | table    | vc

 vc     | vpx_access_seq                             | sequence | vc

 vc     | vpx_access_surr_key_seq                    | sequence | vc

 vc     | vpx_alarm                                  | table    | vc

 vc     | vpx_alarm_action                           | table    | vc

 vc     | vpx_alarm_disabled_actions                 | table    | vc

 vc     | vpx_alarm_expr_comp                        | table    | vc

 vc     | vpx_alarm_expr_comp_surr_key_seq           | sequence | vc

 vc     | vpx_alarm_expression                       | table    | vc

 vc     | vpx_alarm_repeat_action                    | table    | vc

 vc     | vpx_alarm_runtime                          | table    | vc

 vc     | vpx_alarm_seq                              | sequence | vc

 vc     | vpx_alarm_state                            | table    | vc

 vc     | vpx_ansfile_seq                            | sequence | vc

 vc     | vpx_array_seq                              | sequence | vc

 vc     | vpx_binary_data                            | table    | vc

 vc     | vpx_binary_data_seq                        | sequence | vc

 vc     | vpx_callback_service                       | table    | vc

 vc     | vpx_callback_service_seq                   | sequence | vc

 vc     | vpx_callback_whitelist                     | table    | vc

 vc     | vpx_change_tag                             | table    | vc

 vc     | vpx_change_tag_seq                         | sequence | vc

 vc     | vpx_cluster_iofilters                      | table    | vc

 vc     | vpx_compliance_status                      | table    | vc

 vc     | vpx_compliance_status_seq                  | sequence | vc

 vc     | vpx_compute_res_failover_host              | table    | vc

 vc     | vpx_compute_res_user_hb_ds                 | table    | vc

 vc     | vpx_compute_resource                       | table    | vc

 vc     | vpx_compute_resource_das_vm                | table    | vc

 vc     | vpx_compute_resource_dpm_host              | table    | vc

 vc     | vpx_compute_resource_drs_vm                | table    | vc

 vc     | vpx_compute_resource_orc_vm                | table    | vc

 vc     | vpx_compute_resource_vsan_host             | table    | vc

 vc     | vpx_config_issue                           | table    | vc

 vc     | vpx_cp_policy                              | table    | vc

 vc     | vpx_cp_policy_seq                          | sequence | vc

 vc     | vpx_crypto_kmip_cluster                    | table    | vc

 vc     | vpx_crypto_server                          | table    | vc

 vc     | vpx_customization_spec                     | table    | vc

 vc     | vpx_das_hb_datastore_sys                   | table    | vc

 vc     | vpx_datacenter                             | table    | vc

 vc     | vpx_datastore                              | table    | vc

 vc     | vpx_dbm_counter_metadata                   | table    | vc

 vc     | vpx_dbm_counter_value                      | table    | vc

 vc     | vpx_device                                 | table    | vc

 vc     | vpx_device_seq                             | sequence | vc

 vc     | vpx_disabled_methods                       | table    | vc

 vc     | vpx_drsrules_seq                           | sequence | vc

 vc     | vpx_ds_assignment                          | table    | vc

 vc     | vpx_ds_info                                | table    | vc

 vc     | vpx_ds_vmfs_extent                         | table    | vc

 vc     | vpx_ds_vmfs_extent_surr_key_seq            | sequence | vc

 vc     | vpx_dual                                   | table    | vc

 vc     | vpx_dvhost                                 | table    | vc

 vc     | vpx_dvhost_hc_mtu_result                   | table    | vc

 vc     | vpx_dvhost_hc_mtu_result_surr_key_seq      | sequence | vc

 vc     | vpx_dvhost_hc_result                       | table    | vc

 vc     | vpx_dvhost_hc_result_surr_key_seq          | sequence | vc

 vc     | vpx_dvhost_hc_vlan_result                  | table    | vc

 vc     | vpx_dvhost_hc_vlan_result_surr_key_seq     | sequence | vc

 vc     | vpx_dvhost_out_of_sync                     | table    | vc

 vc     | vpx_dvport                                 | table    | vc

 vc     | vpx_dvport_membership                      | table    | vc

 vc     | vpx_dvport_setting                         | table    | vc

 vc     | vpx_dvport_setting_surr_key_seq            | sequence | vc

 vc     | vpx_dvport_vlan                            | table    | vc

 vc     | vpx_dvport_vlan_surr_key_seq               | sequence | vc

 vc     | vpx_dvportgroup                            | table    | vc

 vc     | vpx_dvs                                    | table    | vc

 vc     | vpx_dvs_blob                               | table    | vc

 vc     | vpx_dvs_blob_surr_key_seq                  | sequence | vc

 vc     | vpx_dvs_compatible                         | table    | vc

 vc     | vpx_dvs_compatible_surr_key_seq            | sequence | vc

 vc     | vpx_dvs_hc_config                          | table    | vc

 vc     | vpx_dvs_hc_config_surr_key_seq             | sequence | vc

 vc     | vpx_dvs_infra_res_pool                     | table    | vc

 vc     | vpx_dvs_infra_res_pool_surr_key_seq        | sequence | vc

 vc     | vpx_dvs_ipfix                              | table    | vc

 vc     | vpx_dvs_ipfix_surr_key_seq                 | sequence | vc

 vc     | vpx_dvs_lag                                | table    | vc

 vc     | vpx_dvs_lag_surr_key_seq                   | sequence | vc

 vc     | vpx_dvs_lag_vlan                           | table    | vc

 vc     | vpx_dvs_lag_vlan_surr_key_seq              | sequence | vc

 vc     | vpx_dvs_nrp                                | table    | vc

 vc     | vpx_dvs_opaque_data                        | table    | vc

 vc     | vpx_dvs_opaque_data_surr_key_seq           | sequence | vc

 vc     | vpx_dvs_overlay_instance                   | table    | vc

 vc     | vpx_dvs_overlay_instance_surr_key_seq      | sequence | vc

 vc     | vpx_dvs_pvlan                              | table    | vc

 vc     | vpx_dvs_pvlan_surr_key_seq                 | sequence | vc

 vc     | vpx_dvs_rule                               | table    | vc

 vc     | vpx_dvs_rule_qualifier                     | table    | vc

 vc     | vpx_dvs_ruleset                            | table    | vc

 vc     | vpx_dvs_scope                              | table    | vc

 vc     | vpx_dvs_scope_surr_key_seq                 | sequence | vc

 vc     | vpx_dvs_traffic_filter_config              | table    | vc

 vc     | vpx_dvs_traffic_filter_config_surr_key_seq | sequence | vc

 vc     | vpx_dvs_traffic_filter_param               | table    | vc

 vc     | vpx_dvs_traffic_filter_param_surr_key_seq  | sequence | vc

 vc     | vpx_dvs_uplink                             | table    | vc

 vc     | vpx_dvs_uplink_surr_key_seq                | sequence | vc

 vc     | vpx_dvs_vmvnic_res_pool                    | table    | vc

 vc     | vpx_dvs_vmvnic_res_pool_surr_key_seq       | sequence | vc

 vc     | vpx_dvs_vspan_ports                        | table    | vc

 vc     | vpx_dvs_vspan_ports_surr_key_seq           | sequence | vc

 vc     | vpx_dvs_vspan_session                      | table    | vc

 vc     | vpx_dvs_vspan_session_surr_key_seq         | sequence | vc

 vc     | vpx_entity                                 | table    | vc

 vc     | vpx_entity_last_event                      | table    | vc

 vc     | vpx_entity_seq                             | sequence | vc

 vc     | vpx_entity_vmop_count                      | table    | vc

 vc     | vpx_event_1                                | table    | vc

 vc     | vpx_event_10                               | table    | vc

 vc     | vpx_event_11                               | table    | vc

 vc     | vpx_event_12                               | table    | vc

 vc     | vpx_event_13                               | table    | vc

 vc     | vpx_event_14                               | table    | vc

 vc     | vpx_event_15                               | table    | vc

 vc     | vpx_event_16                               | table    | vc

 vc     | vpx_event_17                               | table    | vc

 vc     | vpx_event_18                               | table    | vc

VCDB-# SELECT * FROM vpx_entity

VCDB-# SELECT * FROM vpx_entity WHERE name = '203.68.4.112-ActiveBackupforBusiness';

ERROR:  syntax error at or near "select"

LINE 2: select * from vpx_entity

        ^

VCDB=# SELECT * FROM vpx_entity WHERE name = '203.68.4.112-ActiveBackupforBusiness';                               

  id  |                 name                 | type_id | parent_id 

------+--------------------------------------+---------+-----------

 7661 | 203.68.4.112-ActiveBackupforBusiness |      18 |         5

(1 row)


VCDB=# SELECT * FROM vpx_ds_assignment WHERE ds_id=7661;

 ds_id | entity_id | accessible | mount_path | mount_id | mount_mode | mounted 

-------+-----------+------------+------------+----------+------------+---------

  7661 |      8366 |            |            |          |            |        

(1 row)


VCDB=# DELETE FROM vpx_ds_assignment WHERE ds_id=7661;

DELETE 1

VCDB=# DELETE FROM vpx_datastore WHERE id=7661;

ERROR:  update or delete on table "vpx_datastore" violates foreign key constraint "fk_vpx_vm_ds_space2" on table "vpx_vm_ds_space"

DETAIL:  Key (id)=(7661) is still referenced from table "vpx_vm_ds_space".

VCDB=# DELETE FROM vpx_datastore WHERE id=7661;

ERROR:  update or delete on table "vpx_datastore" violates foreign key constraint "fk_vpx_vm_ds_space2" on table "vpx_vm_ds_space"

DETAIL:  Key (id)=(7661) is still referenced from table "vpx_vm_ds_space".

VCDB=# DELETE FROM vpx_vm_ds_space WHERE ds_id=7661;

DELETE 1

VCDB=# DELETE FROM vpx_datastore WHERE id=7661;

DELETE 1

VCDB=# Delete FROM vpx_entity WHERE name = '203.68.4.112-ActiveBackupforBusiness';

DELETE 1

VCDB=#