当前位置: 首页 > article >正文

Qlik Sense New Install with Restore

Background

In case you meet the upgrade issue like us , you can follow the below step to recover the existing data to new installed Qlik Sense .

Powered by Moshow郑锴-CSDN博客

please follow below steps:

  1. pgsql dump backup
  2. backup table into sql by DBeaver
  3. stop all qlik sense services
  4. rename QlikShare folder to QlikShareXXX
  5. uninstall Qlik Sense (May 2023) with deleting all data
  6. restart computer
  7. pure installation for Qlik Sense (May 2024) with new database setup (please remember your database passw)
  8. ensure all Qlik Sense service are up after reinstall
  9. stop all Qlik Sense service except Qlik Sense Repository Database
  10. truncate the table with escape option in the table you want to import , in DBeaver
  11. rename all he backup SQL file with powershell #1 rename
  12. update all the backup SQL file with "SET session_replication_role = replica;" in the beginning   powershell #1 append
  13. list and execute all the SQL file you want to import by powershell #3 execute SQL
  14. restart the computer
  15. check what amazing happens
  16. reimport the license and certificate
  17. verify the app and task , also user , data connection
  18. install the patching
  19. verify again
  20. notice the stakeholders

Backup all table SQL with DBeaver

Backup And Restore Commands

here are some useful dump and restore , also execute sql file script .

cd "C:\Program Files\Qlik\Sense\Repository\PostgreSQL\12.5\bin"

.\dropdb.exe -h localhost -p 4432 -U postgres QSR

.\createdb.exe -h localhost -p 4432 -U postgres -T template0 QSR

.\pg_restore.exe -h localhost -p 4432 -U postgres -d QSR E:\Tools\QSR_backup.tar

.\pg_restore.exe -h localhost -p 4432 -U postgres -d QSR E:\Tools\QSR_backup_148_latest.tar





cd C:\Program Files\Qlik\Sense\Repository\PostgreSQL\14\bin



#dump bakcup

.\pg_dump.exe -h localhost -p 4432 -U postgres -b -F t -f "E:\Tools\QSR_backup_v14_may2024.tar" QSR



#execute single sql

.\psql.exe -h localhost -p 4432 -U postgres -d QSR -f "E:\Tools\593_backup\sql2\AppContents_.sql"

Powershell #1 rename

下面是一个PowerShell脚本,它会遍历 E:\Tools\593_backup\csv 目录下的所有 CSV 文件,并重命名这些文件,去除文件名最前面的 _ 字符。

# Powered by Moshow@zhengkai.blog.csdn.net

# Define the directory path



$directoryPath = "E:\Tools\593_backup\csv"



# Get all CSV files in the directory



$csvFiles = Get-ChildItem -Path $directoryPath -Filter *.csv



# Loop through each file



foreach ($file in $csvFiles) {



    # Get the current file name



    $currentFileName = $file.Name



    # Check if the file name starts with an underscore



    if ($currentFileName.StartsWith("_")) {



        # Create the new file name by removing the leading underscore



        $newFileName = $currentFileName.Substring(1)



        # Define the full path for the new file name



        $newFilePath = Join-Path -Path $directoryPath -ChildPath $newFileName



        # Rename the file



        Rename-Item -Path $file.FullName -NewName $newFilePath

    }

}

Powershell#2 append

下面是一个PowerShell脚本,它会遍历 E:\Tools\593_backup\sql 目录下的所有 SQL 文件,并在每个文件的开头写入 SET session_replication_role = replica; 并换行。

# Powered by Moshow@zhengkai.blog.csdn.net
# Define the directory path

$directoryPath = "E:\Tools\593_backup\sql"



# Get all SQL files in the directory

$sqlFiles = Get-ChildItem -Path $directoryPath -Filter *.sql



# Loop through each file

foreach ($file in $sqlFiles) {

    # Read the current content of the file

    $content = Get-Content -Path $file.FullName



    # Prepend the new line to the content

    $newContent = "SET session_replication_role = replica;" + [Environment]::NewLine + $content



    # Write the new content back to the file

    Set-Content -Path $file.FullName -Value $newContent

}

Powershell#3 Execute SQL

下面是一个PowerShell脚本,它会遍历 E:\Tools\593_backup\sql2 目录下的所有 SQL 文件,并针对每个文件执行命令 .\psql.exe -h localhost -p 4432 -U postgres -d QSR -f "E:\Tools\593_backup\sql2\"+文件名,同时把已执行过的文件名输出到 E:\Tools\593_backup\sql_result.txt。

# Replace with your actual passw , once you input the credential here , it will auto put into the pgsql without any manual input .

# Powered by Moshow@zhengkai.blog.csdn.net
# Define the directory paths

$psqlDirectory = "C:\Program Files\Qlik\Sense\Repository\PostgreSQL\14\bin"

$directoryPath = "E:\Tools\593_backup\sql2"

$resultFile = "E:\Tools\593_backup\sql_result.txt"

$pgPassword = "*********" # Replace with your actual passw



# Change to the psql directory

Set-Location -Path $psqlDirectory



# Get all SQL files in the directory

$sqlFiles = Get-ChildItem -Path $directoryPath -Filter *.sql



# Loop through each file

foreach ($file in $sqlFiles) {

    # Define the full path for the SQL file

    $filePath = Join-Path -Path $directoryPath -ChildPath $file



    # Set the PGPASSWORD environment variable

    $env:PGPASSWORD = $pgPassword



    # Execute the psql command

    & .\psql.exe -h localhost -p 4432 -U postgres -d QSR -f $filePath



    # Check if the command was successful

    if ($LASTEXITCODE -eq 0) {

        # Append the file name to the result file

        Add-Content -Path $resultFile -Value $file

License issue when enter QMC

go to DBeaver and search the "Licenses" table ,clean the record, should be only one record here .


http://www.kler.cn/a/586840.html

相关文章:

  • 【PlatformIO】基于Arduino的ESP8266 锂电池电压、电量测试
  • 射频前端模块(FEM)的基本原理与架构:从组成到WiFi路由器的应用
  • 1、操作系统引论
  • C语言 | 二叉树打印效果,控制台打印
  • 【Git学习笔记】Git初识及其结构原理分析(一)
  • JavaScript性能优化的几个方面入手
  • matlab 谐波分析公式绘图
  • Three.js 实现云状特效
  • Global Mapper 多功能的GIS软件
  • Python 本地翻译库 googletrans
  • 华为机试牛客刷题之HJ5 进制转换
  • 「为爱发电」的硬核打开方式,涂鸦智能用AIoT引领智慧能源变革
  • The Rust Programming Language 学习 (五)
  • 人工智能技术与应用演讲(61页PPT)(文末有下载方式)
  • [已解决]UserWarning: __floordiv__ is deprecated
  • memcpy,memmove,strstr的模拟实现
  • 微店商品详情页的常见结构及爬虫解析方法
  • PCIe信号传输的幕后:HCSL与LP-HCSL深度解析
  • Canoe Panel基础功能介绍
  • ERROR: There are no scenarios; must have at least one.