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

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 .

相关文章:

  • 【开源代码解读】AI检索系统R1-Searcher通过强化学习RL激励大模型LLM的搜索能力
  • Word 小黑第36套
  • 探索Maas平台与阿里 QWQ 技术:AI调参的魔法世界
  • 在PowerShell脚本中编辑appsettings.json
  • 鸿蒙(OpenHarmony)开发实现 息屏/亮屏 详情
  • Vue本地开发调试使用Proxy实现接口代理配合Nginx实现瓦片png文件代理,实现本地模拟GIS开发环境
  • 《解锁Netlify:静态网站托管》:此文为AI自动生成
  • 探索 Trossen AI:从 Aloha到智能机器人平台的进化之路
  • 大数据学习(69)- OLAP和OLTP
  • list常用接口及模拟实现
  • 如何查看mysql某个表占用的空间大小
  • 用 Vue 3.5 TypeScript 重新开发3年前甘特图的核心组件
  • Linux find 命令完全指南
  • 【Unbuntu安装docker】
  • Tomcat新手登峰指南:从零到部署的原子化实践
  • 《解锁Flutter:跨平台开发的未来之光》:此文为AI自动生成
  • Linux下GCC和C++实现带多组标签的Snowflake SQL查询批量数据导出程序
  • Linux常用命令速查手册
  • 一键爬取b站视频
  • 「JavaScript深入」理解 JavaScript 中的不可变对象(Immutable Object)
  • 匈牙利外长称匈方已驱逐两名乌克兰外交官
  • 习近平出席俄罗斯纪念苏联伟大卫国战争胜利80周年庆典
  • 追光|铁皮房、土操场,这有一座“筑梦”摔跤馆
  • 国新办将于5月8日10时就《民营经济促进法》有关情况举行新闻发布会
  • 韩正出席庆祝中国欧盟建交50周年招待会并致辞
  • 86岁书画家、美术教育家、吴昌硕嫡裔曾孙吴民先离世