日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

6.0版本升級7.0版本不兼容項檢查參考指南

在升級AnalyticDB PostgreSQL 6.0版AnalyticDB PostgreSQL 7.0版時,需要您手工預處理兩個版本存在的不兼容項。本文以Linux環境下連接AnalyticDB PostgreSQL 6.0版實例為例,介紹通過執行Shell腳本檢查常規不兼容項的方法。

注意事項

業務SQL、自定義存儲過程、自定義函數和自定義視圖不包含在檢查項目內,您需要根據實際情況在AnalyticDB PostgreSQL 7.0版中進行驗證。

Shell腳本參考

#!/bin/bash

#
# Copyright (c) 2023, Alibaba Group, Inc.
#
# Description:  check unsupported items before upgrade instance.
# Usage:        sh 6x_to_7x_check.sh <PGHOST> <PGPORT> <PGUSER> <PGPASSWORD>
# CheckList:
#          1) 檢查實例版本
#          2) 檢查libraries
#          4) 檢查表字段類型
#          5) 檢查oss_ext外表
#          6) 檢查擴展模塊
#          7) 檢查存儲過程/函數
# Notice:  如果提示錯誤信息,請人工修改數據庫對應項。
#

if [[ $# -lt 4 ]]; then
    echo "Usage: $0 <PGHOST> <PGPORT> <PGUSER> <PGPASSWORD>"
    exit 1
fi
export PGHOST=$1
export PGPORT=$2
export PGUSER=$3
export PGPASSWORD=$4

db_ver=`psql -d postgres -c "copy (select version()) to stdout"`
db_names=`psql -d postgres -c "copy (select sodddatname from gp_toolkit.gp_size_of_database) to stdout"`
db_names=(${db_names})
db_len=${#db_names[@]}

unsupport7x_ext="('adbpg_desensitization', 'adbpg_hardware_bench', 'address_standardizer', 'address_standardizer_data_us', 'auto_partition', 'automerge_status', 'diskquota', 'fastann', 'hyjal_pb_formatter', 'madlib', 'morton_code', 'multi_master', 'multicorn', 'open_analytic', 'oss_ext', 'pljava', 'plpython2u', 'plpythonu', 'querycache', 'redis_fdw')"
unsupport7x_type="('abstime', 'reltime', 'tinterval', 'unknown')"

# 檢查實例版本
check_version()
{
  echo ''
  echo $db_ver
  echo ''
  echo '********** check base version...'
  base_time=`date -d "2023-01-31" +%s`
  db_verdate=${db_ver##*compiled on}
  seconds=`date -d "$db_verdate" +%s`
  if [[ $seconds -lt $base_time ]]; then
    echo 'ERROR: please upgrade minor version...'
  else
    echo 'pass......'
  fi
}

# 檢查libraries
check_libraries()
{
  echo ''
  echo '********** check untransferred libraries...'
  count=`psql -d postgres -c "copy (select count(1) from pg_catalog.pg_library) to stdout"`
  if [[ $count -gt 0 ]]; then
    psql -d postgres -c "select name,lanname language from pg_catalog.pg_library;"
    echo "ERROR: please drop unsupported libraries manually..."
  else
    echo 'pass......'
  fi
}


# 檢查表字段類型
check_table_ftype()
{
  echo ''
  echo '********** check unsupported table field types...'
  count=0
  if [[ $db_ver == *9.4*6.* ]]; then
    for ((i=0; i<$db_len; ++i)); do
      sql="select count(1) from pg_catalog.pg_class c,pg_catalog.pg_attribute a,pg_catalog.pg_type t where
      a.atttypid=t.oid and a.attrelid=c.oid and a.attnum>0 and c.relnamespace <> 11 and t.typname in $unsupport7x_type"
      count1=`psql -d ${db_names[$i]} -c "copy ($sql) to stdout"`
      count=$((count + count1))
      if [[ $count1 -gt 0 ]]; then
        sql="select '${db_names[$i]}' dbname,n.nspname schema,c.relname table_name,a.attname field_name,t.typname field_type from
        pg_catalog.pg_namespace n,pg_catalog.pg_class c,pg_catalog.pg_attribute a,pg_catalog.pg_type t
        where a.atttypid=t.oid and n.oid=c.relnamespace and a.attrelid=c.oid and a.attnum>0 and c.relnamespace <> 11 and t.typname in $unsupport7x_type order by schema,table_name;"
        psql -d ${db_names[$i]} -c "$sql"
      fi
    done
  fi
  if [[ $count -gt 0 ]]; then
    echo 'ERROR: please alter table field types manually...'
  else
    echo 'pass......'
  fi
}

#檢查oss_ext外部表
check_oss_ext()
{
  echo ''
  echo '********** check oss external table...'
  count=0
  if [[ $db_ver == *9.4*6.* ]]; then
    for ((i=0; i<$db_len; ++i)); do
      count1=`psql -d ${db_names[$i]} -c "copy (select count(*) from pg_class c join pg_exttable e on c.oid = e.reloid where c.relstorage = 'x' and  e.urilocation[1] like '%oss://%') to stdout"`
      count=$((count + count1))
      if [[ $count1 -gt 0 ]]; then
        psql -d ${db_names[$i]} -c "select '${db_names[$i]}' dbname, c.relname from pg_class c join pg_exttable e on c.oid = e.reloid where c.relstorage = 'x' and  e.urilocation[1] like '%oss://%';"
      fi
    done
  fi
  if [[ $count -gt 0 ]]; then
    echo 'WARN: please drop oss external table manually...'
    echo 'HINT: oss external table is unsupported, please change to oss foreign table'
  else
    echo 'pass......'
  fi
}

# 檢查擴展模塊
check_extensions()
{
  echo ''
  echo '********** check unsupported extensions...'
  count=0
  if [[ $db_ver == *9.4*6.* ]]; then
    for ((i=0; i<$db_len; ++i)); do
      count1=`psql -d ${db_names[$i]} -c "copy (select count(1) from pg_catalog.pg_extension where extname in $unsupport7x_ext) to stdout"`
      count=$((count + count1))
      if [[ $count1 -gt 0 ]]; then
        psql -d ${db_names[$i]} -c "select '${db_names[$i]}' dbname,extname,extversion from pg_catalog.pg_extension where extname in $unsupport7x_ext;"
      fi
    done
  fi
  if [[ $count -gt 0 ]]; then
    echo 'WARN: please drop useless extensions manually...'
    echo 'HINT: 1. please change plpythonu to plpython3u(include related functions) 2. oss_ext is unsupported, please change to oss_fdw'
    echo 'REF DROP EXTENSION SQL: drop extension <name> '
  else
    echo 'pass......'
  fi
}



check_version
check_libraries
check_table_ftype
check_oss_ext
check_extensions

參數說明如下:

參數

說明

<PGHOST>

AnalyticDB PostgreSQL 6.0版實例的連接地址。

<PGPORT>

AnalyticDB PostgreSQL 6.0版實例的端口號。

<PGUSER>

連接AnalyticDB PostgreSQL 6.0版實例的數據庫賬號。

<PGPASSWORD>

賬號對應的密碼。

操作步驟

  1. 執行以下命令在Linux設備中安裝postgresql客戶端。

    sudo yum install postgresql
  1. 查看Linux設備外網地址。登錄AnalyticDB PostgreSQL控制臺,將Linux設備的外網IP地址添加至AnalyticDB PostgreSQL 6.0版實例的白名單中,詳情請參見設置白名單

  2. 使用Linux設備連接待檢查不兼容項的AnalyticDB PostgreSQL 6.0版實例。

    psql -h <PGHOST> -p <PGPORT> -U <PGUSER>
  1. 編輯保持Shell腳本,如6x_to_7x.sh的腳本文件,運行以下命令執行檢查不兼容項的腳本文件6x_to_7x_check.sh。

    sh 6x_to_7x_check.sh <PGHOST> <PGPORT> <PGUSER> <PGPASSWORD>
  2. 根據提示信息,修改數據庫中對應的不兼容項,修改完畢后,請再次執行腳本查看結果是否通過檢查。

檢查結果參考

檢查通過情況(運行腳本后全部顯示“pass”,或者不包含“ERROR”信息)

********** check base version...
pass......

********** check untransferred libraries...
pass......

********** check unsupported table field types...
pass......

********** check oss external table...
pass......

********** check unsupported extensions...
pass......

存在不兼容項的檢查情況(提示ERROR信息的必須修改)

PostgreSQL 9.4.26 (Greenplum Database 6.6.0 build dev) on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 9.2.1 20200522 (Alibaba 9.2.1-3 2.17), 64-bit compiled on Dec 15 2023 16:44:16

********** check base version...
ERROR: please upgrade minor version...

********** check untransferred libraries...
 name | language 
----------+----------
 select_1 | plpgsql
(1 row)

WARN: please transfer libraries manually...

********** check unsupported table field types...
 dbname | schema | table_name | field_name | field_type 
--------+--------+------------+------------+------------
 adbpg | public | test2 | name | unknown
(1 row)

ERROR: please alter table field types manually...

********** check oss external table...

 dbname | relname 
--------+----------
 testdb | testoss
 testdb | testoss2
 testdb | testoss3
(3 rows)

WARN: please drop oss external table manually...
HINT: oss external table is unsupported, please change to oss foreign table

********** check unsupported extensions...
 dbname | extname | extversion 
--------+---------+------------
 adbpg | fastann | 1.0
(1 row)

WARN: please drop useless extensions manually...
REF DROP EXTENSION SQL: drop extension <name> 

提示信息

修改方式

ERROR: please upgrade minor version...

升級實例內核小版本,詳情請參見版本升級

WARN: please transfer libraries manually...

提示AnalyticDB PostgreSQL 6.0版庫中用到了library,這些library不會自動遷移,升級后您需要手工進行遷移。

ERROR: please alter table field types manually...

提示AnalyticDB PostgreSQL 6.0版庫表存在不兼容的字段類型,需要在AnalyticDB PostgreSQL 6.0版庫中手動修改。

WARN: please drop oss external table manually...

提示AnalyticDB PostgreSQL 6.0版庫使用了OSS External TABLE,在AnalyticDB PostgreSQL 7.0版中不再支持,需要轉換為OSS Foreign TABLE。

WARN: please drop useless extensions manually...

提示AnalyticDB PostgreSQL 6.0版庫中存在不兼容的擴展模塊,這些模塊不會遷移。

  • 如果用到不兼容的擴展模塊,需要考慮修改涉及模塊的表或存儲過程等。

  • 如果沒用到,可考慮刪除。