cable – Cabling on PC with two drives, procedure to toss one drive?

My PC has two drives with …

enter image description here

… braided cable B1 comes from the motherboard,

and then there appears to be a “jumper” B2 on to the second drive.

Then, each drive has it’s own independent, normal, flat cable F1 and F2.

  1. Which is power and which data?

In fact I want to simply throw away the blueplatter drive (ie, I want the machine to have only one drive, the green one).

  1. Is it perfectly OK to simply disconnect B2 and F2, to throw away the blue drive?

  2. So, it’s perfectly ok to just leave the “jumper” B2 dangling? (It doesn’t need, who knows, a terminator or such?)

Thx

How to keep history of MySQL/Aurora stored procedure revisions?

We need to maintain the history of the procedures. I think it will be easier to save the history in a table so every time someone either deletes or modifies the content of the procedure it will go and save the changes to a table to maintain an history. May be upto a point a trigger can help, but wanted to check if anyone has any custom script written on this already which can be reviewed?

how to clear mysql cache inside of stored procedure?

how to clear mysql cache inside of stored procedure? I have mysql store procedure called test2.i execute it using another store procedure called test1. test 1 have for each loop and inside of that loop I execute test2. if loop have only one round its get 34.294 sec for execute. if loop have 30 rounds it get 1360.641 sec. that the reason for above question.i already try with Flush and RESET Queries.

partitioning – Procedure: How to create mirror RAID via ZFS on a fresh install of Ubuntu 20.10?

I have two 1TB disks. I ran a fresh install of Ubuntu 20.10 using encryption + ZFS, which installed to /dev/sda.

It created the following:

Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 917DAC1E-06D8-479B-AAC6-43FB711931BD

Device       Start        End    Sectors  Size Type
/dev/sda1     2048       4095       2048    1M BIOS boot
/dev/sda2     4096    1054719    1050624  513M EFI System
/dev/sda3  1054720    5249023    4194304    2G Linux swap
/dev/sda4  5249024    9443327    4194304    2G Solaris boot
/dev/sda5  9443328 1953525134 1944081807  927G Solaris root


Disk /dev/sdb: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model:
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 4176D618-E056-4905-BCFE-7ACA909134CD

Lsblck shows:

sda                          931.5G
├─sda1                           1M
├─sda2           vfat          513M /boot/efi
├─sda3           crypto_LUKS     2G
│ └─cryptoswap   swap            2G (SWAP)
├─sda4           zfs_member      2G                              bpool
└─sda5           zfs_member    927G                              rpool
sdb                          931.5G
sr0                           1024M
zd0              crypto_LUKS   500M
└─keystore-rpool ext4          484M /run/keystore/rpool          keystore-rpool

Is there a way to turn /dev/sdb into a proper mirror of /dev/sda using RAIDZ with ZFS? I’ve found some notes and tutorials that seem to give parts (like this askubuntu question, but I think it would already need partitions configured and wouldn’t be a drive mirror, or maybe having a full drive mirror configuration wouldn’t be possible with this ZFS+Encryption fresh installation?

passing variable values to procedure in postgresql via psql

basically I have written a code to pass variable values via psql to my procedure is it supported?
and if supported any pointers to get it done : my code looks like below :

do $$
<<main_block>>
declare
err_msg text;
BEGIN
insert into mig.qb_items (qb_id , sync_token , qb_updated_at , qb_created_at , qb_expired_at , name , sku , description , active , qb_parent_id , taxable , unit_price , transaction_type , category_type , qb_income_account_id , qb_expense_account_id , purchase_description , tax_included , purchase_cost , qb_asset_account_id , track_quantity , inventory_start_date , quantity_on_hand , qb_sales_tax_id , qb_tax_code_id , abatement_rate , reverse_charge_rate , service_type , level, created_at , updated_at , expired_at , ancestor_id , signature , financial_signature , qb_object , print_grouped_items, company_id )
select qb_id , sync_token , qb_updated_at , qb_created_at , qb_expired_at , name , sku , description , active , qb_parent_id , taxable , unit_price , transaction_type , category_type , qb_income_account_id , qb_expense_account_id , purchase_description , tax_included , purchase_cost , qb_asset_account_id , track_quantity , inventory_start_date , quantity_on_hand , qb_sales_tax_id , qb_tax_code_id , abatement_rate , reverse_charge_rate , service_type , level , created_at , updated_at , expired_at , ancestor_id , signature , financial_signature , qb_object , print_grouped_items, :tenant_id as company_id from :schema.qb_items;
update mig.migration_status set status=’COMPLETED’ WHERE schema=:tenant and table_name=’qb_items’;
EXCEPTION WHEN others THEN
GET STACKED DIAGNOSTICS err_msg = MESSAGE_TEXT;
update mig.migration_status set status=’FAILED’ WHERE schema=:tenant and table_name=’qb_items’;
raise notice ‘EXCEPTION %’, err_msg;
END main_block;
$$;

bt i am getting error as below :

psql:/home/ec2-user/scripts/qb_items.sql:14: ERROR: syntax error at or near “:”
LINE 7: …cial_signature , qb_object , print_grouped_items, :tenant_id…

sql server – SQL: How to define two or more conditions into a stored procedure with inner join?

Thanks for your time.

I am unable to find a solution for my procedure in SQL.
First, I needed to filter the data from the tables TbTaxCompanies and tbCompany, through the variable @company_id… and works!

CREATE PROC taxcompany_importTaxes
@company_id int
AS
SELECT tc.idtaxcompany, tc.company_id, c.nameCompany, ct.tax1, ct.tax2, ct.tax3, ct.dateUpgrade
FROM tbTaxCompanies tc
INNER JOIN tbCompany c on tc.company_id = c.idcompany
WHERE tc.company_id=@company_id
ORDER BY tc.idtaxcompany asc
go

And second I need to filter again the set of logs from the company selected previously with @company_id, but now to obtain only the last updated taxes… and DOES NOT WORK!

CREATE PROC taxcompany_importTaxes
@company_id int
AS
SELECT tc.idtaxcompany, tc.company_id, c.nameCompany, ct.tax1, ct.tax2, ct.tax3, ct.dateUpdate
FROM tbTaxCompanies tc
INNER JOIN tbCompany c on tc.company_id = c.idcompany
WHERE tc.company_id=@company_id AND (tc.dateUpdate =(SELECT MAX (dateUpdate) FROM tbTaxCompanies))
ORDER BY tc.idtaxcompany asc
go

I really appreciate your help. I hope I can help someone in the future too. Thank you.

plsql – Rewrite existing procedure without merge as Oracle 12.1 doesn’t support it

I have a procedure where data is pushed into table using merge logic used as part of it.
The procedure takes string passed at runtime and splits it into rows.

I need to change the merge part using any other method other than merge, maybe cursor for loop as Oracle 12.1 does not support merge and similar take input string and insert/update accordingly in the destination table.
inside procedure and we cannot get it upgraded due to constraints.

So everything in proc would be same just that it would be without merge.

The details are inside the fiddle with table and sample data.

https://dbfiddle.uk/?rdbms=oracle_11.2&fiddle=34a88972aa53cf60b1199f9f277285f4

mp.mathematical physics – How can one recover/obtain information from the renormalization group procedure?

I know the basic idea behind the renormalization group approach as it is used in mathematical physics to study both QFT and statistical mechanics. However, I have trouble understanding how can one recover the information one was trying to obtain using this technique. Let me elaborate.

Although there is no such thing as a ‘general approach’ to RG, I want to try to sketch the ideas from a generic model. As stated in Brydges & Kennedy’s article, one starts with integrals of the form:
begin{eqnarray}
Z(varphi) = int dmu_{C}(psi) e^{-V_{0}(psi+varphi)} = (mu_{C}*e^{-V_{0}})(varphi) tag{1}label{1}
end{eqnarray}

where $varphi = (varphi_{x})_{xin Lambda}$ is a Gaussian process with joint distribution $mu_{C}$, mean zero and covariance $C$. Suppose we can write $C$ as a sum $C=C_{1}+C_{2}$. Then:
begin{eqnarray}
Z(varphi) = int dmu_{C_{1}+C_{2}}(psi)e^{-V_{0}(psi+varphi)} = int dmu_{C_{2}}(zeta)int dmu_{C_{1}}(psi) e^{-V_{0}(psi+varphi+zeta)} = int dmu_{C_{2}}(zeta) (mu_{C_{1}}*e^{-V_{0}})(varphi+zeta) = int dmu_{C_{2}}(zeta)e^{-V_{1}(varphi+zeta)} tag{2}label{2}
end{eqnarray}

where:
begin{eqnarray}
V_{1} = -ln mu_{C_{1}}*e^{-V_{0}} tag{3}label{3}
end{eqnarray}

Thus, we can define a map on the (informal) space of actions, called renormalization group map and denoted by $RG$, such that $RG: V_{0} to V_{1}$. Analogously, if $C=C_{1}+cdots +C_{n}$, $n ge 2$, then sucessive applications of (ref{2}) lead to:
begin{eqnarray}
Z(varphi) = int dmu_{C_{n}}(zeta_{n})(mu_{C_{n-1}}*e^{-V_{n-1}})(varphi+zeta_{n}) = int dmu_{C_{n}}(zeta_{n})e^{-V_{n}(varphi+zeta_{n})} tag{4}label{4}
end{eqnarray}

where $V_{n}= RG(V_{n-1})=cdots = RG^{n-1}(V_{0})$. We thus defined a ‘trajectory’ $V_{0}to V_{1}to V_{2}to cdots to V_{n}$.

All these being said, I believe the main idea of the process is to (luckily) prove that the above trajectory ends up in a fixed point. In other words, luckily we have $RG^{n}(V_{0}) = V^{*}$ for every $n$ suficiently large.

The above scenario, although very generic, appears in some discussions on the topic. As an example, see Salmhofer’s book.
Now comes my questions.

(1) How can one recover the information about $Z(varphi)$ once we was lucky and obtained $V^{*}$? See, $Z(varphi)$ was our object of study in the first place, right? But I don’t see how to get back and obtain it.

(2) One situation in which the covariance splits into a sum of covariances is when one is trying to approach the continuum limit from a scaled lattice. This can be done in either QFT and statistical mechanics, but I believe it is more common for QFT models. But when we think about statistical mechanics, can one obtain critical temperatures, critical exponents and other thermodynamics entities from the above process? Is it possible to ilustrate how it could be done considering this very generic model?

procedural – Oracle PL/SQL Procedure Unpivot data into rows and push into table

I have a PL/SQL procedure which takes string at runtime which is comma separated,splits it and pushes into table.
Example of procedure and table is given here:
Procedure is push_data.
Current table where data is getting inserted is push_data_temp.

https://dbfiddle.uk/?rdbms=oracle_18&fiddle=fae31c11a4ad6205ebcaa418a0bffffd

Now as per requirement, i need to write a new procedure where logic would remain same of splitting data, but in the new table push_data_pivot(structure inside pivot), should display data pivoted in this format.

Ex: if currently data in push_data_temp is:
enter image description here

The data should go in push_data_pivot in the new procedure as:
enter image description here

The logic should remain same, just that the data getting inserted would go into columns instead of rows, populating id and value columns.

Here column id, is the unique identifier for the string passed in both tables. Basically, it is same as the one used in original table.

Was unable to update fiddle for push_data_pivot structure so mentioning the latest structure and data here:
PUSH_DATA_PIVOT :

create table PUSH_DATA_PIVOT
(
id_pk NUMBER,
  id NUMBER,
  label_id number,
  label varchar2(4000),
  value varchar2(4000)
);

insert into push_data_pivot values(1,null,'COL01',null);
insert into push_data_pivot values(1,null,'COL02',null);
insert into push_data_pivot values(1,null,'COL03',null);
insert into push_data_pivot values(1,null,'COL04',null);
insert into push_data_pivot values(1,null,'COL05',null);
insert into push_data_pivot values(1,null,'COL06',null);
insert into push_data_pivot values(1,null,'COL07',null);
insert into push_data_pivot values(1,null,'COL08',null);
insert into push_data_pivot values(1,null,'COL09',null);
insert into push_data_pivot values(1,null,'COL10',null);
insert into push_data_pivot values(1,null,'COL11',null);
insert into push_data_pivot values(1,null,'COL12',null);
insert into push_data_pivot values(1,null,'COL13',null);
insert into push_data_pivot values(1,null,'COL14',null);

The sample data is single string, for single label_id and corresponding set of column label values.However actual table would have multiple such strings inserted on basis of id column, same as original requirement. This is already handled in existing procedure using cursor.

The only requirement is, to create new procedure with new destination table as push_data_pivot and data in unpivoted format. Split logic would be same as in existing procedure.

Help required on Stored procedure – PostgreSQL

I am new to PostgreSQL and I have basic knowldge in SQL. Is the below code is correct for rename and to create new table same as renamed table?

CREATE OR REPLACE PROCEDURE sp_purge("ReName" varchar(15), todaydate varchar(15))
AS $$
BEGIN
ALTER TABLE test rename to "test@ReName";
EXECUTE format(
           'CREATE TABLE %I AS SELECT * from ',
           'test_old_' || todaydate
        );

END ;
$$
LANGUAGE plpgsql;

CALL sp_purge(“_old”, “_old_05112020”);

Output expection:

Rename table should be : test_old

new table name should be : test_old_05112020